libs/uci: fix attempt to assign empty tables in uci bind class

This commit is contained in:
Jo-Philipp Wich 2009-10-15 16:22:03 +00:00
parent f7ab20f6e3
commit 98187975f9

View file

@ -126,7 +126,11 @@ end
function bsection.set(self, k, v, c) function bsection.set(self, k, v, c)
local stat local stat
if type(c) == "string" then if type(c) == "string" then
if type(v) == "table" and #v == 0 then
stat = self:uciop("delete", c, k)
else
stat = self:uciop("set", c, k, v) stat = self:uciop("set", c, k, v)
end
else else
self:uciop("foreach", self.stype, self:uciop("foreach", self.stype,
function(s) function(s)