From 9c43a261a8d43d0396ae30a8146bd5a3e91424ab Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Thu, 22 Nov 2018 19:57:00 -0500 Subject: [PATCH] reduce coroutine creation --- sys/apis/event.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/apis/event.lua b/sys/apis/event.lua index e228e5e..2a66542 100644 --- a/sys/apis/event.lua +++ b/sys/apis/event.lua @@ -108,7 +108,9 @@ function Event.off(h) if h and h.event then for _,event in pairs(h.event) do local handler = Event.types[event][h.uid] - handler:terminate() + if handler then + handler:terminate() + end Event.types[event][h.uid] = nil end elseif h and h.co then