From 67b41fb91ab30848d1ca2d57fcee27a8bfb4c3a3 Mon Sep 17 00:00:00 2001 From: samuel-p Date: Thu, 27 Feb 2020 19:35:37 +0100 Subject: [PATCH] fixed type error --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b828da0..b826fdd 100644 --- a/index.js +++ b/index.js @@ -120,7 +120,7 @@ const check = async () => { for (const service of config.services) { const oldStatus = cache[service.id]; const newStatus = await checkService(service, oldStatus); - if (oldStatus.status !== newStatus.status) { + if (!oldStatus || oldStatus.status !== newStatus.status) { console.log(service.id + ' status changed: ' + newStatus.status); await pushStatusToCachet(service.id, newStatus.status); cache[service.id] = newStatus;