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 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 {