From fddffee348def818ee041f768f51788f306d49b8 Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Fri, 10 Jul 2026 23:17:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(config):=20=E5=A2=9E=E5=8A=A0cfg=E7=9A=84?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=A3=80=E6=9F=A5=E9=81=BF=E5=85=8D=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改gate.lua和ticketmachine.lua中的版本更新判断逻辑,新增对cfg变量的类型检查,避免当cfg为nil或非table类型时触发访问异常,提升代码健壮性。 --- gate.lua | 2 +- ticketmachine.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gate.lua b/gate.lua index 89f7e5b..671d94c 100644 --- a/gate.lua +++ b/gate.lua @@ -1427,7 +1427,7 @@ while true do pcall(function() refreshRemoteLuaVersion(guessBaseFromStatusURL(serverURL)) end) - 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 pendingGateUpdate = true end diff --git a/ticketmachine.lua b/ticketmachine.lua index ce9281f..98e07aa 100644 --- a/ticketmachine.lua +++ b/ticketmachine.lua @@ -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