From 1f596b43a0a5133be901dd6ab930f83c9a14fdd1 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sun, 4 Apr 2021 00:33:32 +0300
Subject: [PATCH] fixed MID_MUSIC case in Mix_LoadMUSType_RW():
without this, music->error might have never set to true.
---
music.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/music.c b/music.c
index 680adf8..8fe8eca 100644
--- a/music.c
+++ b/music.c
@@ -672,12 +672,14 @@ Mix_Music *Mix_LoadMUSType_RW(SDL_RWops *rw, Mix_MusicType type, int freesrc)
#ifdef MID_MUSIC
case MUS_MID:
music->type = MUS_MID;
+ music->error = 1;
#ifdef USE_NATIVE_MIDI
if ( native_midi_ok ) {
music->data.nativemidi = native_midi_loadsong_RW(rw, freesrc);
if ( music->data.nativemidi == NULL ) {
Mix_SetError("%s", native_midi_error());
- music->error = 1;
+ } else {
+ music->error = 0;
}
break;
}
@@ -685,8 +687,8 @@ Mix_Music *Mix_LoadMUSType_RW(SDL_RWops *rw, Mix_MusicType type, int freesrc)
#ifdef USE_FLUIDSYNTH_MIDI
if ( fluidsynth_ok ) {
music->data.fluidsynthmidi = fluidsynth_loadsong_RW(rw, freesrc);
- if ( music->data.fluidsynthmidi == NULL ) {
- music->error = 1;
+ if ( music->data.fluidsynthmidi != NULL ) {
+ music->error = 0;
}
break;
}
@@ -696,11 +698,11 @@ Mix_Music *Mix_LoadMUSType_RW(SDL_RWops *rw, Mix_MusicType type, int freesrc)
music->data.midi = Timidity_LoadSong_RW(rw, freesrc);
if ( music->data.midi == NULL ) {
Mix_SetError("%s", Timidity_Error());
- music->error = 1;
+ } else {
+ music->error = 0;
}
} else {
Mix_SetError("%s", Timidity_Error());
- music->error = 1;
}
#endif
break;