fix(lgui): 安全处理os.pullEvent调用

添加对os.pullEvent函数的类型检查,防止在函数不可用时抛出错误
This commit is contained in:
2025-09-03 14:41:52 +08:00
parent 130d71b8c7
commit c91c989b57
2 changed files with 9 additions and 2 deletions

View File

@@ -592,7 +592,14 @@ end
function GUIManager:handleEvents()
while self.running do
local event = {os.pullEvent()}
-- Safely get the pullEvent function
local pullEventFunc = os.pullEvent
if type(pullEventFunc) ~= "function" then
error("os.pullEvent is not a function")
end
-- Get the next event
local event = {pullEventFunc()}
local eventName = event[1]
local handled = false