From 95d359a90344c61c3974dc969bd917e50785e383 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sun, 25 May 2025 05:20:19 +0200 Subject: [PATCH] Return null instead of undefined when folder needs relocation or does not exist during revert --- main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 988701c..05b29bb 100644 --- a/main.js +++ b/main.js @@ -857,7 +857,7 @@ app.whenReady().then(() => { // Diff ipcMain.handle('diff-commit', async (_e, folderObj, hash) => { if (folderObj.needsRelocation || !fs.existsSync(folderObj.path)) { - return; + return null; } const git = simpleGit(folderObj.path); return git.diff([`${hash}^!`]); @@ -865,6 +865,9 @@ app.whenReady().then(() => { // Revert ipcMain.handle('revert-commit', async (_e, folderObj, hash) => { + if (folderObj.needsRelocation || !fs.existsSync(folderObj.path)) { + return; + } const git = simpleGit(folderObj.path); await git.revert(hash, ['--no-edit']); });