luci-base: uci.js: do not issue malformed uci/delete requests
[oweals/luci.git] / modules / luci-base / htdocs / luci-static / resources / uci.js
index 916dbb310b166f48dae0885cf9c762086159a15f..6bbd1bc37ce192afccab7446136d43891201ddbb 100644 (file)
@@ -547,9 +547,13 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ {
                                c[conf][sid] = {};
 
                        /* undelete option */
-                       if (d[conf] && d[conf][sid])
+                       if (d[conf] && d[conf][sid]) {
                                d[conf][sid] = d[conf][sid].filter(function(o) { return o !== opt });
 
+                               if (d[conf][sid].length == 0)
+                                       delete d[conf][sid];
+                       }
+
                        c[conf][sid][opt] = val;
                }
                else {