Browse Source

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
pull/3919/head
veins1 9 months ago
committed by GitHub
parent
commit
289e7d3a6c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/raudio.c

+ 2
- 0
src/raudio.c View File

@ -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…
Cancel
Save