libs/uci: fix attempt to assign empty tables in uci bind class
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 15 Oct 2009 16:22:03 +0000 (16:22 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 15 Oct 2009 16:22:03 +0000 (16:22 +0000)
libs/uci/luasrc/model/uci/bind.lua

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