1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Check rw in musicclass::init()

It's possible that SDL_RWFromMem could return NULL, and if this is the
case, then we really shouldn't be passing it to MusicTrack().
This commit is contained in:
Misa 2020-08-14 02:23:41 -07:00 committed by Ethan Lee
parent 6bed5fc88c
commit c95b95f5b7

View file

@ -83,7 +83,14 @@ void musicclass::init()
if (index >= 0 && index < musicReadBlob.max_headers) \ if (index >= 0 && index < musicReadBlob.max_headers) \
{ \ { \
rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); \ rw = SDL_RWFromMem(musicReadBlob.getAddress(index), musicReadBlob.getSize(index)); \
if (rw == NULL) \
{ \
printf("Unable to read music file header: %s\n", SDL_GetError()); \
} \
else \
{ \
musicTracks.push_back(MusicTrack( rw )); \ musicTracks.push_back(MusicTrack( rw )); \
} \
} }
TRACK_NAMES TRACK_NAMES