fix(config): 增加cfg的类型检查避免运行时报错
修改gate.lua和ticketmachine.lua中的版本更新判断逻辑,新增对cfg变量的类型检查,避免当cfg为nil或非table类型时触发访问异常,提升代码健壮性。
This commit is contained in:
+1
-1
@@ -681,7 +681,7 @@ local function backgroundSyncTask()
|
||||
sleep(UPDATE_CHECK_INTERVAL)
|
||||
pcall(refreshConfigOnce)
|
||||
|
||||
if type(CFG.force_update) == 'boolean' and CFG.force_update == true and versionMismatch == true then
|
||||
if type(cfg) == 'table' and type(cfg.force_update) == 'boolean' and cfg.force_update == true and versionMismatch == true then
|
||||
pendingMachineUpdate = true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user