From: Darius Date: Wed, 26 Sep 2018 07:59:08 +0000 (+0300) Subject: luci-base: cbi.lua: fix TypedSection.parse() X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e5071c88f07f933521e39125cebba7244e94d760;p=oweals%2Fluci.git luci-base: cbi.lua: fix TypedSection.parse() It's not necessary to execute all code if section already exists. Signed-off-by: Darius Joksas [reword commit message, squash commits, remove stray semicolon] Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/luasrc/cbi.lua b/modules/luci-base/luasrc/cbi.lua index d275c5b27..971830fe8 100644 --- a/modules/luci-base/luasrc/cbi.lua +++ b/modules/luci-base/luasrc/cbi.lua @@ -1199,19 +1199,20 @@ function TypedSection.parse(self, novld) if name then -- Ignore if it already exists if self:cfgvalue(name) then - name = nil; - end - - name = self:checkscope(name) - - if not name then + name = nil self.err_invalid = true - end + else + name = self:checkscope(name) + + if not name then + self.err_invalid = true + end - if name and #name > 0 then - created = self:create(name, origin) and name - if not created then - self.invalid_cts = true + if name and #name > 0 then + created = self:create(name, origin) and name + if not created then + self.invalid_cts = true + end end end end