From 01f743f4664ef15d3d91e8294645cdee304c665f Mon Sep 17 00:00:00 2001 From: AShiningRay Date: Sat, 21 Oct 2023 21:16:43 -0300 Subject: [PATCH] PlatformPlayer: Close midi sequencer if the stream wasn't opened 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. --- src/org/recompile/mobile/PlatformPlayer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/recompile/mobile/PlatformPlayer.java b/src/org/recompile/mobile/PlatformPlayer.java index 7c400766..f329ff5b 100644 --- a/src/org/recompile/mobile/PlatformPlayer.java +++ b/src/org/recompile/mobile/PlatformPlayer.java @@ -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()