fix(utils): Only call callback if type(callback) == "function" (#2038)

This commit is contained in:
IguanaCucumber
2025-02-23 15:16:18 +00:00
committed by GitHub
parent 12509903a5
commit 1deeb87b68

View File

@@ -44,7 +44,9 @@ end
---@param name string ---@param name string
event.emit = function(self, name, ...) event.emit = function(self, name, ...)
for _, callback in ipairs(self.events[name] or {}) do for _, callback in ipairs(self.events[name] or {}) do
callback(...) if type(callback) == "function" then
callback(...)
end
end end
end end