Skip to content

Commit

Permalink
Fix exception when disposing sim sequencers (#9919)
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll authored Mar 18, 2024
1 parent 526c75a commit 86a050d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pxtsim/sound/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace pxsim.music {

dispose() {
if (this.metronome) this.metronome.dispose();
this.metronome = undefined
this.stop();
this.currentlyPlaying = undefined;
this.listeners = {};
Expand Down Expand Up @@ -88,7 +89,7 @@ namespace pxsim.music {
stop(sustainCurrentSounds = false) {
if (this._state === "stop") return;
this._state = "stop";
this.metronome.stop();
if (this.metronome) this.metronome.stop();
this.fireStateChange();

if (!sustainCurrentSounds) this.currentCancelToken.cancelled = true;
Expand Down

0 comments on commit 86a050d

Please sign in to comment.