Fixed crash on absent or invalid jukebox directory (testing scandir() return value)
This commit is contained in:
parent
a4beacd08a
commit
c6407e0c2d
|
@ -3,6 +3,7 @@ D2X-Rebirth Changelog
|
|||
20071105
|
||||
--------
|
||||
arch/carbon/conf.h, English.lproj/InfoPlist.strings, d2x-Info.plist, d2xgl-Info.plist: update Mac version info, set SHAREPATH to application folder for Mac OS X
|
||||
arch/sdl/jukebox.c: Fixed crash on absent or invalid jukebox directory
|
||||
|
||||
20071103
|
||||
--------
|
||||
|
|
|
@ -89,11 +89,12 @@ void jukebox_load() {
|
|||
JukeboxSongs = dl_init();
|
||||
count = scandir(jukebox_path, &files, file_select, alphasort);
|
||||
|
||||
printf("Jukebox: %d music file(s) found in %s\n", count, jukebox_path);
|
||||
|
||||
for (i=0; i<count; i++) dl_add(JukeboxSongs, files[i]->d_name);
|
||||
|
||||
jukebox_loaded = 1;
|
||||
if (count > 0) {
|
||||
printf("Jukebox: %d music file(s) found in %s\n", count, jukebox_path);
|
||||
for (i=0; i<count; i++) dl_add(JukeboxSongs, files[i]->d_name);
|
||||
jukebox_loaded = 1;
|
||||
}
|
||||
else { printf("Jukebox music could not be found!\n"); }
|
||||
}
|
||||
}
|
||||
else { printf("Jukebox already loaded\n"); }
|
||||
|
|
Loading…
Reference in a new issue