From fd02eee9c147ba87ee7ff4b9611042d393ee0756 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sat, 23 Feb 2019 15:09:05 +0100 Subject: [PATCH] Fixed an possible sounds issue --- shared/js/sound/Sounds.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/js/sound/Sounds.ts b/shared/js/sound/Sounds.ts index 98c68d9e..ac40f8ca 100644 --- a/shared/js/sound/Sounds.ts +++ b/shared/js/sound/Sounds.ts @@ -240,6 +240,10 @@ namespace sound { const path = "audio/" + file.filename; const context = audio.player.context(); + if(!context) { + console.warn(tr("Tried to replay a sound without an audio context (Sound: %o). Dropping playback"), sound); + return; + } const volume = get_sound_volume(sound, options.default_volume); console.log(tr("Replaying sound %s (Sound volume: %o | Master volume %o)"), sound, volume, master_volume);