mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
fix(lgui): 安全处理os.pullEvent调用
添加对os.pullEvent函数的类型检查,防止在函数不可用时抛出错误
This commit is contained in:
@@ -592,7 +592,14 @@ end
|
|||||||
|
|
||||||
function GUIManager:handleEvents()
|
function GUIManager:handleEvents()
|
||||||
while self.running do
|
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 eventName = event[1]
|
||||||
local handled = false
|
local handled = false
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-- LeonOS installer
|
-- LeonOS installer
|
||||||
local INSTALLER_VERSION = "0.3.8 Beta 3 Alpha 3"
|
local INSTALLER_VERSION = "0.3.8 Beta 4"
|
||||||
local DEFAULT_ROM_DIR = "/leonos"
|
local DEFAULT_ROM_DIR = "/leonos"
|
||||||
|
|
||||||
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")
|
print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")
|
||||||
|
|||||||
Reference in New Issue
Block a user