Skip to content

Commit

Permalink
PlatformPlayer: Only stop media playback if it is running
Browse files Browse the repository at this point in the history
"Orcs and Elves" constantly tries to stop a MIDI stream that isn't
even running, and ends up causing a stack overflow on
PlatformPlayer. Since it only makes sense to stop streams that are
actually running, add a check for cases where they aren't.
  • Loading branch information
AShiningRay committed Oct 21, 2023
1 parent d8aa5d9 commit e6a96db
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/org/recompile/mobile/PlatformPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public void start()

public void stop()
{
if(!isRunning()) { return; }
midi.stop();
state = Player.PREFETCHED;
tick = midi.getTickPosition();
Expand Down Expand Up @@ -341,6 +342,7 @@ public void start()

public void stop()
{
if(!isRunning()) { return; }
wavClip.stop();
time = wavClip.getMicrosecondPosition();
state = Player.PREFETCHED;
Expand Down

0 comments on commit e6a96db

Please sign in to comment.