Skip to content

πŸ†™ Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows.

Add file access error

Nayam Amarshe0ff2eb8224c5
diff --git a/electron/utils/convert-and-scale.ts b/electron/utils/convert-and-scale.ts
index 8850c85..7d8eac9 100644
--- a/electron/utils/convert-and-scale.ts
+++ b/electron/utils/convert-and-scale.ts
@@ -1,3 +1,4 @@
+import fs from "fs";
import sharp, { FormatEnum } from "sharp";
import logit from "./logit";
import { getMainWindow } from "../main-window";
@@ -15,6 +16,12 @@ const convertAndScale = async (
const originalImage = await sharp(originalImagePath).metadata();
+ fs.access(originalImagePath, fs.constants.F_OK, (err) => {
+ if (err) {
+ throw new Error("Could not grab the original image!");
+ }
+ });
+
if (!mainWindow || !originalImage) {
throw new Error("Could not grab the original image!");
}