From 008056f07107bb206546ab27f4437d6d53752d90 Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Mon, 8 Nov 2021 14:36:02 +0530 Subject: fix: check if 'app.mainWindow' is present to avoid js errors (#2189) --- src/lib/Tray.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/lib/Tray.js b/src/lib/Tray.js index e7afc3552..eb6732c30 100644 --- a/src/lib/Tray.js +++ b/src/lib/Tray.js @@ -32,6 +32,9 @@ export default class TrayIcon { { label: 'Show Ferdi', click() { + if (!app.mainWindow) { + return; + } if (app.mainWindow.isMinimized()) { app.mainWindow.restore(); } else if (app.mainWindow.isVisible()) { @@ -45,6 +48,9 @@ export default class TrayIcon { { label: 'Disable Notifications & Audio', click() { + if (!app.mainWindow) { + return; + } app.mainWindow.webContents.send('muteApp'); }, }, @@ -99,6 +105,9 @@ export default class TrayIcon { } this.trayIcon.on('click', () => { + if (!app.mainWindow) { + return; + } if (app.mainWindow.isMinimized()) { app.mainWindow.restore(); } else if (app.mainWindow.isVisible()) { -- cgit v1.2.3-54-g00ecf