fix: crashing with JS error
This commit is contained in:
parent
a98461ade0
commit
ba5c4fe706
1 changed files with 2 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue