From: Holger Schemel Date: Mon, 6 Mar 2023 23:04:23 +0000 (+0100) Subject: fixed returning from function with incomplete list pointers X-Git-Tag: 4.3.5.2~17 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=74f1c3f9a5358be42791f2560660dbda81179b06;p=rocksndiamonds.git fixed returning from function with incomplete list pointers --- diff --git a/src/files.c b/src/files.c index 834154c8..676ebf8a 100644 --- a/src/files.c +++ b/src/files.c @@ -12944,6 +12944,7 @@ void LoadMusicInfo(void) DirectoryEntry *dir_entry; struct FileInfo *music, *sound; struct MusicFileInfo *next, **new; + boolean read_music_from_directory = TRUE; int i; while (music_file_info != NULL) @@ -12996,10 +12997,11 @@ void LoadMusicInfo(void) { Warn("cannot read music directory '%s'", music_directory); - return; + read_music_from_directory = FALSE; } - while ((dir_entry = readDirectory(dir)) != NULL) // loop all entries + while (read_music_from_directory && + (dir_entry = readDirectory(dir)) != NULL) // loop all entries { char *basename = dir_entry->basename; boolean music_already_used = FALSE; @@ -13037,7 +13039,8 @@ void LoadMusicInfo(void) num_music_noconf++; } - closeDirectory(dir); + if (dir != NULL) + closeDirectory(dir); for (i = 0; i < num_sounds; i++) {