Skip to content

Commit

Permalink
PlatformPlayer: Close midi sequencer if the stream wasn't opened
Browse files Browse the repository at this point in the history
Since we will manually try to load streams without an explicit type
as one of the supported formats, opening a midi stream is now far
more likely to fail, so account for that and close the Sequencer
whenever that is the case.
  • Loading branch information
AShiningRay committed Oct 22, 2023
1 parent 05e945c commit 01f743f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/org/recompile/mobile/PlatformPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ public midiPlayer(InputStream stream)
midi.setSequence(stream);
state = Player.PREFETCHED;
}
catch (Exception e) { System.out.println("Couldn't load MIDI file: " + e.getMessage()); }
catch (Exception e)
{
System.out.println("Couldn't load MIDI file: " + e.getMessage());
midi.close();
}
}

public void start()
Expand Down

0 comments on commit 01f743f

Please sign in to comment.