From af60bcad496aa99469f9204d45a687ad8aed74fa Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Mon, 19 Jun 2023 12:47:23 +0700 Subject: [PATCH] add missed checks to i_winmusc and i_flmusic --- src/i_flmusic.c | 14 ++++++++++++++ src/i_winmusic.c | 1 + 2 files changed, 15 insertions(+) diff --git a/src/i_flmusic.c b/src/i_flmusic.c index 844d5595..40aedc97 100644 --- a/src/i_flmusic.c +++ b/src/i_flmusic.c @@ -222,6 +222,13 @@ static boolean I_FL_InitMusic(int device) synth = new_fluid_synth(settings); + if (synth == NULL) + { + fprintf(stderr, + "I_FL_InitMusic: FluidSynth failed to initialize synth.\n"); + return false; + } + lumpnum = W_CheckNumForName("SNDFONT"); if (lumpnum >= 0) { @@ -337,6 +344,13 @@ static void *I_FL_RegisterSong(void *data, int len) player = new_fluid_player(synth); + if (player == NULL) + { + fprintf(stderr, + "I_FL_InitMusic: FluidSynth failed to initialize player.\n"); + return NULL; + } + if (IsMid(data, len)) { result = fluid_player_add_mem(player, data, len); diff --git a/src/i_winmusic.c b/src/i_winmusic.c index 7b1eaa79..b3d91a7c 100644 --- a/src/i_winmusic.c +++ b/src/i_winmusic.c @@ -1432,6 +1432,7 @@ static boolean I_WIN_InitMusic(int device) if (mmr != MMSYSERR_NOERROR) { MidiError("midiStreamOpen", mmr); + hMidiStream = NULL; return false; }