Skip to content

Commit

Permalink
Fix exception when disposing sim sequencers
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Mar 15, 2024
1 parent 526c75a commit 1bb8d95
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 1bb8d95

Please sign in to comment.