From 744e720c3b41d176d5424fa718a9c39155cda38a Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 5 Sep 2019 23:59:32 -0700 Subject: [PATCH] Ignore play() when called before init() If an error occurs during startup, then it's possible that we'll try to call sound.play('ERROR') in the error handler, which will throw an exception. Instead, just don't play sounds in this case. --- src/renderer/lib/sound.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/renderer/lib/sound.js b/src/renderer/lib/sound.js index 0bcfe077..8ea3b45d 100644 --- a/src/renderer/lib/sound.js +++ b/src/renderer/lib/sound.js @@ -55,6 +55,10 @@ function init (appState) { } function play (name) { + if (state == null) { + return + } + if (!state.saved.prefs.soundNotifications) { return }