Reset music.ctxType if loading wasn't succesful (#3917)
Fixes some crashes, e.g. calling StopMusicStream after trying to load Music from a non-existant .mp3 file
This commit is contained in:
parent
583f81f458
commit
289e7d3a6c
1 changed files with 2 additions and 0 deletions
|
@ -1461,6 +1461,7 @@ Music LoadMusicStream(const char *fileName)
|
|||
#endif
|
||||
|
||||
music.ctxData = NULL;
|
||||
music.ctxType = MUSIC_AUDIO_NONE;
|
||||
TRACELOG(LOG_WARNING, "FILEIO: [%s] Music file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
|
@ -1670,6 +1671,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
#endif
|
||||
|
||||
music.ctxData = NULL;
|
||||
music.ctxType = MUSIC_AUDIO_NONE;
|
||||
TRACELOG(LOG_WARNING, "FILEIO: Music data could not be loaded");
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue