mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-10 19:09:45 +01:00
Check if file can't be loaded in SoundTrack::SoundTrack()
This adds a check that the pointer passed to FILESYSTEM_loadFileToMemory() isn't NULL, and if it is, just returns early in the function, instead of continuing later and producing a different, slightly-misleading error message.
This commit is contained in:
parent
f401cc6230
commit
8052f61cef
1 changed files with 5 additions and 0 deletions
|
@ -33,6 +33,11 @@ SoundTrack::SoundTrack(const char* fileName)
|
|||
unsigned char *mem;
|
||||
size_t length = 0;
|
||||
FILESYSTEM_loadFileToMemory(fileName, &mem, &length);
|
||||
if (mem == NULL)
|
||||
{
|
||||
fprintf(stderr, "Unable to load WAV file %s\n", fileName);
|
||||
return;
|
||||
}
|
||||
SDL_RWops *fileIn = SDL_RWFromMem(mem, length);
|
||||
sound = Mix_LoadWAV_RW(fileIn, 1);
|
||||
FILESYSTEM_freeMemory(&mem);
|
||||
|
|
Loading…
Reference in a new issue