From f7fd661482fad9982df64ed54c8f4d2a9162c002 Mon Sep 17 00:00:00 2001 From: Nikita Kuznetsov Date: Mon, 1 Apr 2024 15:53:33 +0200 Subject: [PATCH] Fix application open after close --- apps/desktop/src/electron/mainWindow.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/electron/mainWindow.ts b/apps/desktop/src/electron/mainWindow.ts index 09b6fc6ed..510f027ca 100644 --- a/apps/desktop/src/electron/mainWindow.ts +++ b/apps/desktop/src/electron/mainWindow.ts @@ -20,7 +20,7 @@ export abstract class MainWindow { static mainWindow: BrowserWindow | undefined = undefined; static async openMainWindow() { - if (this.mainWindow !== undefined) return this.mainWindow; + if (this.mainWindow !== undefined && this.mainWindow !== null) return this.mainWindow; const icon = (() => { switch (process.platform) { @@ -58,7 +58,7 @@ export abstract class MainWindow { this.mainWindow.on('closed', () => { ipcMain.removeHandler('message'); - this.mainWindow = null; + this.mainWindow = undefined; }); ipcMain.handle('message', async (event, message: Message) => {