From bf336ce0a58fe3f14c1064d2b65bdd12e3277603 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 19 Aug 2024 09:48:45 -0700 Subject: [PATCH] Add null monitor check to Network Service --- Server/service/networkService.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Server/service/networkService.js b/Server/service/networkService.js index 375380f2e..b688b6fff 100644 --- a/Server/service/networkService.js +++ b/Server/service/networkService.js @@ -16,6 +16,14 @@ class NetworkService { async handleNotification(job, isAlive) { const { _id } = job.data; const monitor = await this.db.getMonitorById(_id); + if (monitor === null || monitor === undefined) { + logger.error(`Null Monitor: ${_id}`, { + method: "handleNotification", + service: this.SERVICE_NAME, + jobId: job.id, + }); + return; + } // If monitor status changes, update monitor status and send notification if (monitor.status !== isAlive) {