From 39b68e24e6b6c0a2687d8fc4b357e42adf7373e1 Mon Sep 17 00:00:00 2001 From: rohan-buchner Date: Thu, 9 Sep 2021 09:21:09 +0200 Subject: [PATCH] Prevent script crash if no previous versions exist --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 22e7e2b..fafb844 100644 --- a/index.js +++ b/index.js @@ -119,9 +119,11 @@ class Action { res.on("data", chunk => body += chunk) res.on("end", () => { const existingVersions = JSON.parse(body) - const checkSum = existingVersions - .items - .every((node) => { + const checkSum = null + let prevVersions = existingVersions.items; + + if(prevVersions) + prevVersions.every((node) => { if (!node.items) return true; // this will quit the loop if true