From 32db4f5cc960a2ea7b3080c99d7ba2a8aca31171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 24 Nov 2020 16:55:46 +0800 Subject: enable invalid config --- script/config.lua | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/script/config.lua b/script/config.lua index 107f874b..92ed0491 100644 --- a/script/config.lua +++ b/script/config.lua @@ -182,22 +182,26 @@ function m.setConfig(config, other) local region = ConfigTemplate[c] if region then local info = region[k] - local suc, v = info[2](v) - if suc then - m.config[c][k] = v - else - m.config[c][k] = info[1] + if info then + local suc, v = info[2](v) + if suc then + m.config[c][k] = v + else + m.config[c][k] = info[1] + end end end end end for k, v in pairs(other) do local info = OtherTemplate[k] - local suc, v = info[2](v) - if suc then - m.other[k] = v - else - m.other[k] = info[1] + if info then + local suc, v = info[2](v) + if suc then + m.other[k] = v + else + m.other[k] = info[1] + end end end log.debug('Config update: ', util.dump(m.config), util.dump(m.other)) -- cgit v1.2.3