foxygit / doom Log in
commit 842601745dcf0a2e04b04ef59e1e7956211973c4
Author:     Michael Day <contact@michaelcday.com>
AuthorDate: Wed Mar 22 23:41:11 2023 -0400
Commit:     Michael Day <contact@michaelcday.com>
CommitDate: Wed Mar 22 23:41:11 2023 -0400

    Properly init `fsynth_sf_path` in setup

    Fixes crash when trying to set the FluidSynth soundfont path in the
    setup program.
---
 src/setup/sound.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/setup/sound.c b/src/setup/sound.c
index 02d5a56f..5b148d98 100644
--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -91,7 +91,7 @@ int winmm_chorus_level = -1;
 #endif

 #ifdef HAVE_FLUIDSYNTH
-char *fsynth_sf_path = "";
+char *fsynth_sf_path = NULL;
 int fsynth_chorus_active = 1;
 float fsynth_chorus_depth = 5.0f;
 float fsynth_chorus_level = 0.35f;
@@ -404,6 +404,10 @@ void BindSoundVariables(void)
     timidity_cfg_path = M_StringDuplicate("");
     gus_patch_path = M_StringDuplicate("");

+#ifdef HAVE_FLUIDSYNTH
+    fsynth_sf_path = M_StringDuplicate("");
+#endif
+
     // All versions of Heretic and Hexen did pitch-shifting.
     // Most versions of Doom did not and Strife never did.
     snd_pitchshift = gamemission == heretic || gamemission == hexen;