From ac35bab987b4023366a33e6bb1fd5314dffae88f Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 3 Dec 2020 14:55:19 +0200 Subject: [PATCH] Fix 'cannot read property hide of null' error on quit (#1594) Signed-off-by: Jari Kolehmainen --- src/main/exit-app.ts | 6 +++--- src/main/window-manager.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/exit-app.ts b/src/main/exit-app.ts index 63fe7673e6..eb035eff96 100644 --- a/src/main/exit-app.ts +++ b/src/main/exit-app.ts @@ -10,10 +10,10 @@ export function exitApp() { const clusterManager = ClusterManager.getInstance(); appEventBus.emit({ name: "service", action: "close" }); - windowManager.hide(); - clusterManager.stop(); + windowManager?.hide(); + clusterManager?.stop(); logger.info("SERVICE:QUIT"); setTimeout(() => { app.exit(); }, 1000); -} \ No newline at end of file +} diff --git a/src/main/window-manager.ts b/src/main/window-manager.ts index b60e7400ea..7013966f08 100644 --- a/src/main/window-manager.ts +++ b/src/main/window-manager.ts @@ -163,8 +163,8 @@ export class WindowManager extends Singleton { } hide() { - if (!this.mainWindow?.isDestroyed()) this.mainWindow.hide(); - if (!this.splashWindow.isDestroyed()) this.splashWindow.hide(); + if (this.mainWindow && !this.mainWindow.isDestroyed()) this.mainWindow.hide(); + if (this.splashWindow && !this.splashWindow.isDestroyed()) this.splashWindow.hide(); } destroy() {