From 62932046e44bc99b4a4ff2ac0b63e50d01d46120 Mon Sep 17 00:00:00 2001 From: Agampreet Singh <68941022+agam778@users.noreply.github.com> Date: Sun, 24 Dec 2023 23:03:19 +0530 Subject: [PATCH] Handle exception when closing window - Prevents showing an error if someone tries to close a window with shortcut key if there is no window opened in macOS --- app/menu.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/menu.js b/app/menu.js index a96d57c..4662460 100644 --- a/app/menu.js +++ b/app/menu.js @@ -759,7 +759,11 @@ const menulayout = [ label: "Close Window", accelerator: "CmdOrCtrl+W", click: () => { - BrowserWindow.getFocusedWindow().close(); + try { + BrowserWindow.getFocusedWindow().close(); + } catch { + return; + } }, }, {