diff --git a/src/scripts/renderer/components/keymap.js b/src/scripts/renderer/components/keymap.js index 8a3fa6da..3d92d252 100755 --- a/src/scripts/renderer/components/keymap.js +++ b/src/scripts/renderer/components/keymap.js @@ -29,7 +29,10 @@ Mousetrap.bind('esc', function () { const enabled = prefs.get('close-with-esc'); log('close with esc shortcut, enabled:', enabled); if (enabled) { - remote.getGlobal('application').mainWindowManager.window.close(); + const mwm = remote.getGlobal('application').mainWindowManager; + if (mwm) { + mwm.window.close(); + } } return enabled; }); diff --git a/src/scripts/renderer/preload/listeners.js b/src/scripts/renderer/preload/listeners.js index 53cdc308..187ed085 100644 --- a/src/scripts/renderer/preload/listeners.js +++ b/src/scripts/renderer/preload/listeners.js @@ -7,6 +7,9 @@ remote.getCurrentWebContents().on('context-menu', function (event, params) { params.isWindows7 = platform.isWindows7; params = JSON.stringify(params); log('sending context menu', event, params); - remote.getGlobal('application').mainWindowManager.openContextMenu(params); + const mwm = remote.getGlobal('application').mainWindowManager; + if (mwm) { + mwm.openContextMenu(params); + } event.preventDefault(); }); diff --git a/src/scripts/renderer/webview/listeners.js b/src/scripts/renderer/webview/listeners.js index f95832ea..0c520c20 100755 --- a/src/scripts/renderer/webview/listeners.js +++ b/src/scripts/renderer/webview/listeners.js @@ -32,7 +32,10 @@ webView.addEventListener('page-title-updated', function () { // clear badge either instantly or after delay _delayedRemoveBadge = setTimeout(() => { - remote.getGlobal('application').mainWindowManager.notifCountChanged(count, badgeDataUrl); + const mwm = remote.getGlobal('application').mainWindowManager; + if (mwm && typeof mwm.notifCountChanged === 'function') { + mwm.notifCountChanged(count, badgeDataUrl); + } }, count ? 0 : 1500); });