From: Holger Schemel Date: Wed, 8 Mar 2023 19:56:54 +0000 (+0100) Subject: added checking pointer X-Git-Tag: 4.3.5.2~15 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b48dac24b604cdf088bcdca7392694d3312868e3;p=rocksndiamonds.git added checking pointer --- diff --git a/src/files.c b/src/files.c index 39f145f5..7d0f6f0a 100644 --- a/src/files.c +++ b/src/files.c @@ -13007,9 +13007,16 @@ void LoadMusicInfo(void) // if all levels have game music configured, do not read music from directory if (!checkLevelSetHasMusic_NoConf()) + { read_music_from_directory = FALSE; + } + else if (music_directory == NULL) + { + Warn("cannot find music directory with unconfigured music"); - if ((dir = openDirectory(music_directory)) == NULL) + read_music_from_directory = FALSE; + } + else if ((dir = openDirectory(music_directory)) == NULL) { Warn("cannot read music directory '%s'", music_directory); diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 3d085a9d..a87b0dbc 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -609,7 +609,15 @@ static void LoadCustomMusic_NoConf(void) FreeAllMusic_NoConf(); - if ((dir = openDirectory(music_directory)) == NULL) + if (music_directory == NULL) + { + Warn("cannot find music directory with unconfigured music"); + + audio.music_available = FALSE; + + return; + } + else if ((dir = openDirectory(music_directory)) == NULL) { Warn("cannot read music directory '%s'", music_directory);