luci-base: cbi.lua: fix TypedSection.parse()

It's not necessary to execute all code if section already exists.

Signed-off-by: Darius Joksas <jok.darius@gmail.com>
[reword commit message, squash commits, remove stray semicolon]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Darius 2018-09-26 10:59:08 +03:00 committed by Jo-Philipp Wich
parent f0141773ac
commit e5071c88f0

View file

@ -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 name and #name > 0 then
created = self:create(name, origin) and name
if not created then
self.invalid_cts = true
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
end
end
end
end