From 33f23c3ca9a04d9e3e5467fb4c664c5e210dcfab Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 19 Sep 2021 14:24:18 -0400 Subject: [PATCH] Fixed issue where youtube-dl autoupdates broke if checkExistsWithTimeout failed the first time --- backend/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app.js b/backend/app.js index 173e6ed..7404f3c 100644 --- a/backend/app.js +++ b/backend/app.js @@ -837,7 +837,7 @@ async function checkExistsWithTimeout(filePath, timeout) { fs.access(filePath, fs.constants.R_OK, function (err) { if (!err) { clearTimeout(timer); - watcher.close(); + if (watcher) watcher.close(); resolve(); } }); @@ -847,7 +847,7 @@ async function checkExistsWithTimeout(filePath, timeout) { var watcher = fs.watch(dir, function (eventType, filename) { if (eventType === 'rename' && filename === basename) { clearTimeout(timer); - watcher.close(); + if (watcher) watcher.close(); resolve(); } });