mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 06:47:00 +00:00
fix(lgui): 安全处理os.pullEvent调用
添加对os.pullEvent函数的类型检查,防止在函数不可用时抛出错误
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user