From 3132711b7a04d6bedac1fd862236634c6506f56e Mon Sep 17 00:00:00 2001 From: c0rce Date: Thu, 9 Jul 2020 09:28:28 +0100 Subject: [PATCH] Update 14-persist.js This allows for the case of an empty ENV macro file, otherwise we get an error: 09:21:08 Capacity 'DB is corrupted, cannot JSON parse the DB' 09:21:08 Capacity 'Unhandled promise rejection' [Error: DB_PARSE_ERROR] --- macros/14-persist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/14-persist.js b/macros/14-persist.js index 67dc1cd..effef0f 100644 --- a/macros/14-persist.js +++ b/macros/14-persist.js @@ -39,8 +39,8 @@ async function read() { // Parse contents try { + let data = contents !== '' ? JSON.parse(contents) : ''; console.debug(`DB contains: ${contents}`); - let data = JSON.parse(contents); console.debug('DB successfully parsed'); return data; }