summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/cbi.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-12-05 00:54:18 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-12-05 00:54:18 +0000
commit6c84824d793a9621290485804b0dc370afdefe7b (patch)
tree042ef75afb33abcad719bc032b4db25f318e1966 /libs/web/luasrc/cbi.lua
parent090ce4f17e13e81a459e1ef0e9d6db974d97579c (diff)
libs/web: handle empty tables in Map.set()
Diffstat (limited to 'libs/web/luasrc/cbi.lua')
-rw-r--r--libs/web/luasrc/cbi.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/web/luasrc/cbi.lua b/libs/web/luasrc/cbi.lua
index 6934be690..f4bf18d1e 100644
--- a/libs/web/luasrc/cbi.lua
+++ b/libs/web/luasrc/cbi.lua
@@ -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