libs/web: handle empty tables in Map.set()

This commit is contained in:
Jo-Philipp Wich 2010-12-05 00:54:18 +00:00
parent 090ce4f17e
commit 6c84824d79

View file

@ -378,10 +378,14 @@ end
-- UCI set
function Map.set(self, section, option, value)
if option then
return self.uci:set(self.config, section, option, value)
if type(value) ~= "table" or #value > 0 then
if option then
return self.uci:set(self.config, section, option, value)
else
return self.uci:set(self.config, section, value)
end
else
return self.uci:set(self.config, section, value)
return Map.del(self, section, option)
end
end