From 7133df226f3ac5504e8af3a4693a9b0bd6b4496c Mon Sep 17 00:00:00 2001 From: Nayam Amarshe <25067102+NayamAmarshe@users.noreply.github.com> Date: Thu, 20 Apr 2023 19:27:50 +0530 Subject: [PATCH] Fix null key error --- electron/index.ts | 16 ++++++++-------- package-lock.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/electron/index.ts b/electron/index.ts index 67f0ae4..0feffda 100644 --- a/electron/index.ts +++ b/electron/index.ts @@ -84,8 +84,8 @@ app.on("ready", async () => { // SAVE LAST IMAGE PATH TO LOCAL STORAGE mainWindow.webContents .executeJavaScript('localStorage.getItem("lastImagePath");', true) - .then((lastImagePath) => { - if (lastImagePath.length > 0) { + .then((lastImagePath: string | null) => { + if (lastImagePath && lastImagePath.length > 0) { imagePath = lastImagePath; } }); @@ -93,8 +93,8 @@ app.on("ready", async () => { // SAVE LAST FOLDER PATH TO LOCAL STORAGE mainWindow.webContents .executeJavaScript('localStorage.getItem("lastFolderPath");', true) - .then((lastFolderPath) => { - if (lastFolderPath.length > 0) { + .then((lastFolderPath: string | null) => { + if (lastFolderPath && lastFolderPath.length > 0) { folderPath = lastFolderPath; } }); @@ -105,8 +105,8 @@ app.on("ready", async () => { 'localStorage.getItem("lastCustomModelsFolderPath");', true ) - .then((lastCustomModelsFolderPath) => { - if (lastCustomModelsFolderPath.length > 0) { + .then((lastCustomModelsFolderPath: string | null) => { + if (lastCustomModelsFolderPath && lastCustomModelsFolderPath.length > 0) { customModelsFolderPath = lastCustomModelsFolderPath; } }); @@ -114,8 +114,8 @@ app.on("ready", async () => { // SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE mainWindow.webContents .executeJavaScript('localStorage.getItem("lastOutputFolderPath");', true) - .then((lastOutputFolderPath) => { - if (lastOutputFolderPath.length > 0) { + .then((lastOutputFolderPath: string | null) => { + if (lastOutputFolderPath && lastOutputFolderPath.length > 0) { outputFolderPath = lastOutputFolderPath; } }); diff --git a/package-lock.json b/package-lock.json index e946a28..a255cb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "upscayl", - "version": "2.0.1", + "version": "2.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "upscayl", - "version": "2.0.1", + "version": "2.5.0", "license": "AGPL-3.0", "dependencies": { "app-root-dir": "^1.0.2",