Set error when trying to load MIDI with rwops
authorPatrice Mandin <patmandin@gmail.com>
Tue, 19 Dec 2006 19:41:24 +0000
changeset 335061b50c9cc5c
parent 334 caef5cca8fd0
child 336 ab67d7115d3e
Set error when trying to load MIDI with rwops
music.c
     1.1 --- a/music.c	Tue Nov 28 19:07:27 2006 +0000
     1.2 +++ b/music.c	Tue Dec 19 19:41:24 2006 +0000
     1.3 @@ -1412,21 +1412,25 @@
     1.4  	/* MIDI files have the magic four bytes "MThd" */
     1.5  	if ( strcmp((char *)magic, "MThd") == 0 ) {
     1.6  		music->type = MUS_MID;
     1.7 -		music->error = 1;
     1.8  #ifdef USE_NATIVE_MIDI
     1.9  		if ( native_midi_ok ) {
    1.10  			music->data.nativemidi = native_midi_loadsong_RW(rw);
    1.11 -			if ( music->data.nativemidi ) {
    1.12 -				music->error = 0;
    1.13 +	  		if ( music->data.nativemidi == NULL ) {
    1.14 +		  		Mix_SetError("%s", native_midi_error());
    1.15 +			  	music->error = 1;
    1.16  			}
    1.17  		} MIDI_ELSE
    1.18  #endif
    1.19  #ifdef USE_TIMIDITY_MIDI
    1.20  		if ( timidity_ok ) {
    1.21  			music->data.midi = Timidity_LoadSong_RW(rw);
    1.22 -			if ( music->data.midi ) {
    1.23 -				music->error = 0;
    1.24 +			if ( music->data.midi == NULL ) {
    1.25 +				Mix_SetError("%s", Timidity_Error());
    1.26 +				music->error = 1;
    1.27  			}
    1.28 +		} else {
    1.29 +			Mix_SetError("%s", Timidity_Error());
    1.30 +			music->error = 1;
    1.31  		}
    1.32  #endif
    1.33  	} else