fix(config): 增加cfg的类型检查避免运行时报错

修改gate.lua和ticketmachine.lua中的版本更新判断逻辑,新增对cfg变量的类型检查,避免当cfg为nil或非table类型时触发访问异常,提升代码健壮性。
This commit is contained in:
2026-07-10 23:17:34 +08:00
parent 908fdc2af0
commit fddffee348
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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