fix: crashing with JS error

This commit is contained in:
kmmiio99o 2026-07-02 13:18:23 +02:00
parent a98461ade0
commit ba5c4fe706
No known key found for this signature in database
GPG key ID: AC9D7747D423B9BF

View file

@ -24,6 +24,7 @@ const prepareSound = () =>
let playingTimeout: ReturnType<typeof setTimeout> | null = null; let playingTimeout: ReturnType<typeof setTimeout> | null = null;
let playing = false; let playing = false;
async function playSound() { async function playSound() {
if (!soundPrepared) return;
try { try {
if (playing) { if (playing) {
if (playingTimeout != null) clearTimeout(playingTimeout); if (playingTimeout != null) clearTimeout(playingTimeout);
@ -34,7 +35,7 @@ async function playSound() {
await DCDSoundManager.play(SOUND_ID); await DCDSoundManager.play(SOUND_ID);
playingTimeout = setTimeout(() => { playingTimeout = setTimeout(() => {
playing = false; playing = false;
DCDSoundManager.stop(SOUND_ID); if (soundPrepared) DCDSoundManager.stop(SOUND_ID);
playingTimeout = null; playingTimeout = null;
}, SOUND_DURATION); }, SOUND_DURATION);
} catch { } catch {