From e299b96d1588c6c7550dced1c845524e86c3821b Mon Sep 17 00:00:00 2001 From: Christian Weimann Date: Fri, 10 Jan 2025 06:03:23 +0100 Subject: [PATCH] fix(timer): handle missing timer in isActive method --- utils/TimerMgr.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/TimerMgr.js b/utils/TimerMgr.js index ee4f796..3194248 100644 --- a/utils/TimerMgr.js +++ b/utils/TimerMgr.js @@ -41,8 +41,12 @@ class TimerMgr { return this.#timers.hasOwnProperty(id); } - isActive(identifier) { - return this.#timers[identifier].isActive(); + isActive(id) { + if (!this.hasTimer(id)) { + log.warn(`No timer with id ${id} found`); + return false; + } + return this.#timers[id].isActive(); } cancelAll() {