From 267cd885007a6aaae059c1de23e5dfb73615c34a Mon Sep 17 00:00:00 2001 From: Serdar Sanri Date: Thu, 7 Jul 2022 04:50:10 +0000 Subject: [PATCH] fix for ``` 0|camera | knexError----------------------------------- END 0|camera | TypeError: Cannot read properties of undefined (reading 'forEach') 0|camera | at /home/Shinobi/libs/scheduler.js:11:18 0|camera | at /home/Shinobi/libs/database/utils.js:159:33 0|camera | at __node_internal_ (node:util:281:10) 0|camera | at processTicksAndRejections (node:internal/process/task_queues:83:21) 0|camera | Uncaught Exception occured! Wed Jul 06 2022 03:58:06 GMT+0000 (Coordinated Universal Time) ``` --- libs/scheduler.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/scheduler.js b/libs/scheduler.js index 861f906d..3b3e51d7 100644 --- a/libs/scheduler.js +++ b/libs/scheduler.js @@ -8,10 +8,11 @@ module.exports = function(s,config,lang,app,io){ columns: "*", table: "Schedules" },(err,rows) => { - rows.forEach(function(schedule){ + + rows && rows.forEach(function(schedule){ s.updateSchedule(schedule) }) - if(callback)callback() + if(callback && typeof callback === 'function')callback() }) } //update schedule