From 11f6b82b729550dc6e237ff05d7b4a22f67a89c3 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sun, 26 Dec 2021 14:25:03 +0100 Subject: [PATCH] handler error when loading electron store --- app/src/electron.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/electron.js b/app/src/electron.js index ad5d85df..872342e5 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -168,7 +168,12 @@ ipcMain.handle('openExternal', async (event, url) => { }); function createWindow() { - const bounds = store.get('winBounds'); + let bounds = null; + try { + bounds = store.get('winBounds'); + } catch (err) { + console.log('Error loading bounds from electron store', err.message); + } mainWindow = new BrowserWindow({ width: 1200, @@ -182,8 +187,12 @@ function createWindow() { }, }); - if (store.get('winIsMaximized')) { - mainWindow.maximize(); + try { + if (store.get('winIsMaximized')) { + mainWindow.maximize(); + } + } catch (err) { + console.log('Error loading maximized flag from electron store', err.message); } mainMenu = buildMenu();