From 0e4c3e507d4a095bd602cee08064affcdf6be33f Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Tue, 1 Dec 2020 15:02:56 +0200 Subject: [PATCH] fix 'cannot read property hide of null' error on quit 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 a998a2811f..859845d6b8 100644 --- a/src/main/exit-app.ts +++ b/src/main/exit-app.ts @@ -9,10 +9,10 @@ export function exitApp() { const windowManager = WindowManager.getInstance(); 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 1fa2614c50..fe12063016 100644 --- a/src/main/window-manager.ts +++ b/src/main/window-manager.ts @@ -158,8 +158,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() {