From f6e031a98ab2d5dd8fd7b28a38f8fe3b452af35f Mon Sep 17 00:00:00 2001 From: Lorenzo Cogotti Date: Tue, 19 Sep 2023 18:11:17 +0200 Subject: [PATCH] [timer] Handle cancel(nil) as NOP. --- timer.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/timer.lua b/timer.lua index 823433e..6ea3f7b 100644 --- a/timer.lua +++ b/timer.lua @@ -88,7 +88,9 @@ function Timer:every(delay, after, count) end function Timer:cancel(handle) - self.functions[handle] = nil + if handle then + self.functions[handle] = nil + end end function Timer:clear()