From ba5c4fe7061e3d91ff2183ad4a3d88a2e06ff6f2 Mon Sep 17 00:00:00 2001 From: kmmiio99o Date: Thu, 2 Jul 2026 13:18:23 +0200 Subject: [PATCH] fix: crashing with JS error --- plugins/Moyai/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/Moyai/src/index.ts b/plugins/Moyai/src/index.ts index c710036..7cde288 100644 --- a/plugins/Moyai/src/index.ts +++ b/plugins/Moyai/src/index.ts @@ -24,6 +24,7 @@ const prepareSound = () => let playingTimeout: ReturnType | null = null; let playing = false; async function playSound() { + if (!soundPrepared) return; try { if (playing) { if (playingTimeout != null) clearTimeout(playingTimeout); @@ -34,7 +35,7 @@ async function playSound() { await DCDSoundManager.play(SOUND_ID); playingTimeout = setTimeout(() => { playing = false; - DCDSoundManager.stop(SOUND_ID); + if (soundPrepared) DCDSoundManager.stop(SOUND_ID); playingTimeout = null; }, SOUND_DURATION); } catch {