mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
fix: 修复事件拉取函数的安全性问题并改进错误处理
修复多个文件中事件拉取函数的安全性问题,添加更健壮的fallback机制 在imageview.lua中改进错误信息显示,确保image变量转换为字符串 在pkg.lua中调整JSON序列化参数以生成更紧凑的输出
This commit is contained in:
@@ -592,13 +592,18 @@ end
|
||||
|
||||
function GUIManager:handleEvents()
|
||||
while self.running do
|
||||
-- Safely get the pullEvent function with fallback to rc.pullEvent
|
||||
-- Safely get the pullEvent function with multiple fallbacks
|
||||
local pullEventFunc = os.pullEvent
|
||||
if type(pullEventFunc) ~= "function" then
|
||||
-- Try using rc.pullEvent as fallback
|
||||
pullEventFunc = rc and rc.pullEvent
|
||||
if type(pullEventFunc) ~= "function" then
|
||||
error("Neither os.pullEvent nor rc.pullEvent is available")
|
||||
-- Try using rc.pullEvent as fallback if rc is available
|
||||
if rc and type(rc.pullEvent) == "function" then
|
||||
pullEventFunc = rc.pullEvent
|
||||
else
|
||||
-- In CC Tweaked, os.pullEventRaw is always available
|
||||
pullEventFunc = os.pullEventRaw
|
||||
if type(pullEventFunc) ~= "function" then
|
||||
error("No valid event pulling function found. Ensure you're running in a CC Tweaked environment.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user