From 8e73c1f405d63502cf4ad1dbc9de0379c30d2d50 Mon Sep 17 00:00:00 2001 From: Jason Greer Date: Thu, 21 Nov 2024 19:10:36 -0500 Subject: [PATCH] fix nil error --- OmniCC/core/timer.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OmniCC/core/timer.lua b/OmniCC/core/timer.lua index f1135bf..3af2eaf 100644 --- a/OmniCC/core/timer.lua +++ b/OmniCC/core/timer.lua @@ -38,7 +38,17 @@ Timer.__index = Timer ---@param cooldown OmniCCCooldown function Timer:GetOrCreate(cooldown) - local endTime = (cooldown._occ_start + cooldown._occ_duration) * SECOND + local start = cooldown._occ_start or 0 + if start <= 0 then + return + end + + local duration = cooldown._occ_duration or 0 + if duration <= 0 then + return + end + + local endTime = (start + duration) * SECOND local kind = cooldown._occ_kind local settings = cooldown._occ_settings local key = strjoin('/', kind, tostring(endTime), tostring(settings or 'NONE'))