Skip to content

Commit 289e7d3

Browse files
authored
Reset music.ctxType if loading wasn't succesful (raysan5#3917)
Fixes some crashes, e.g. calling StopMusicStream after trying to load Music from a non-existant .mp3 file
1 parent 583f81f commit 289e7d3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/raudio.c

+2
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,7 @@ Music LoadMusicStream(const char *fileName)
14611461
#endif
14621462

14631463
music.ctxData = NULL;
1464+
music.ctxType = MUSIC_AUDIO_NONE;
14641465
TRACELOG(LOG_WARNING, "FILEIO: [%s] Music file could not be opened", fileName);
14651466
}
14661467
else
@@ -1670,6 +1671,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
16701671
#endif
16711672

16721673
music.ctxData = NULL;
1674+
music.ctxType = MUSIC_AUDIO_NONE;
16731675
TRACELOG(LOG_WARNING, "FILEIO: Music data could not be loaded");
16741676
}
16751677
else

0 commit comments

Comments
 (0)