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() {