Skip to content

Commit

Permalink
Add error handling to when initializing midi to play a song fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
playmer authored and Wohlstand committed Jul 15, 2024
1 parent 1361bfc commit 9cf5a5e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/codecs/music_nativemidi_alt_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static int init_midi_out(NativeMidiSong *seqi)
if (err != MMSYSERR_NOERROR)
{
seqi->out = NULL;
return -1;
return 1;
}

for(i = 0; i < 16; i++)
Expand Down Expand Up @@ -315,7 +315,10 @@ static int NativeMidiThread(void *context)
return 1;
}

init_midi_out(music);
if (init_midi_out(music)) {
Mix_SetError("Native MIDI Win32-Alt: midiOutOpen failed (%lu)\n", (unsigned long)GetLastError());
return 1;
}

midi_seq_set_loop_enabled(music->song, 1);
midi_seq_set_loop_count(music->song, music->loops < 0 ? -1 : (music->loops + 1));
Expand Down

0 comments on commit 9cf5a5e

Please sign in to comment.