luci-base: do not assume a fixed host address in delegated prefix (#1484)
[project/luci.git] / modules / luci-base / luasrc / model / uci.lua
index 1659137742940ea0621e2b57e98232f393dc7efa..577c6cde08eaa6e10887c97b26fed000f3289070 100644 (file)
@@ -111,7 +111,7 @@ function Cursor.get_list(self, config, section, option)
                local val = self:get(config, section, option)
                return ( type(val) == "table" and val or { val } )
        end
-       return nil
+       return {}
 end
 
 function Cursor.get_first(self, conf, stype, opt, def)
@@ -139,6 +139,9 @@ end
 
 function Cursor.set_list(self, config, section, option, value)
        if config and section and option then
+               if not value or #value == 0 then
+                       return self:delete(config, section, option)
+               end
                return self:set(
                        config, section, option,
                        ( type(value) == "table" and value or { value } )