From e9145432357d217e0030360fa2d7a0c005297fa9 Mon Sep 17 00:00:00 2001 From: David <75678655+David-Werth@users.noreply.github.com> Date: Sun, 27 Oct 2024 19:30:36 +0400 Subject: [PATCH] Add null check on metadata, Continue upscayl if metadata readig failed --- electron/commands/double-upscayl.ts | 3 +-- electron/commands/image-upscayl.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/electron/commands/double-upscayl.ts b/electron/commands/double-upscayl.ts index d179fb0..3d3ae77 100644 --- a/electron/commands/double-upscayl.ts +++ b/electron/commands/double-upscayl.ts @@ -56,7 +56,6 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => { ELECTRON_COMMANDS.UPSCAYL_ERROR, "Failed to read metadata.", ); - return; } // COPY IMAGE TO TMP FOLDER @@ -141,7 +140,7 @@ const doubleUpscayl = async (event, payload: DoubleUpscaylPayload) => { if (!mainWindow) return; if (!failed2 && !stopped) { try { - await writeMetadata(outFile, metadata, exiftool); + if (metadata) await writeMetadata(outFile, metadata, exiftool); } catch (error) { logit("❌ Error writing metadata: ", error); mainWindow.webContents.send( diff --git a/electron/commands/image-upscayl.ts b/electron/commands/image-upscayl.ts index ca3c36f..2225d75 100644 --- a/electron/commands/image-upscayl.ts +++ b/electron/commands/image-upscayl.ts @@ -58,7 +58,6 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => { ELECTRON_COMMANDS.UPSCAYL_ERROR, "Failed to read metadata.", ); - return; } const outFile = @@ -159,7 +158,7 @@ const imageUpscayl = async (event, payload: ImageUpscaylPayload) => { const onClose = async () => { if (!failed && !stopped) { try { - await writeMetadata(outFile, metadata, exiftool); + if (metadata) await writeMetadata(outFile, metadata, exiftool); } catch (error) { logit("❌ Error writing metadata: ", error); mainWindow.webContents.send(