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