From 9463bd0d8619af0fe93b2afd76d8e01829394cc9 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Fri, 24 May 2019 22:55:35 +0200 Subject: [PATCH] fixed app crash for not directly initialized audio contexts --- shared/js/sound/Sounds.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/shared/js/sound/Sounds.ts b/shared/js/sound/Sounds.ts index 15ebb46b..59fb00a3 100644 --- a/shared/js/sound/Sounds.ts +++ b/shared/js/sound/Sounds.ts @@ -106,10 +106,12 @@ namespace sound { export function set_master_volume(volume: number) { volume_require_save = volume_require_save || master_volume != volume; master_volume = volume; - if(master_mixed.gain.setValueAtTime) - master_mixed.gain.setValueAtTime(volume, 0); - else - master_mixed.gain.value = volume; + if(master_mixed) { + if(master_mixed.gain.setValueAtTime) + master_mixed.gain.setValueAtTime(volume, 0); + else + master_mixed.gain.value = volume; + } } export function overlap_activated() : boolean {