From 31c7cecaf9c4c3b34a1f4bbfc559a17db8151be6 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 20 Mar 2020 10:54:01 -0400 Subject: [PATCH] add a few checks for safety --- lib/storage/file.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/storage/file.js b/lib/storage/file.js index 4f7cf54a6..65ff86bac 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -59,7 +59,8 @@ var channelExists = function (filepath, cb) { }; const destroyStream = function (stream) { - stream.close(); + if (!stream) { return; } + try { stream.close(); } catch (err) { console.error(err); } setTimeout(function () { try { stream.destroy(); } catch (err) { console.log(err); } }, 5000);