luci-app-adblock-fast: bugfix: dnsmasq_instance & smartdns_instance parsing
[project/luci.git] / applications / luci-app-adblock-fast / htdocs / luci-static / resources / view / adblock-fast / overview.js
index e6251064833b366eac0801f7dfb643a511893bb5..e97722317cf2d65350f62e9570e7e51c10686c21 100644 (file)
@@ -209,13 +209,15 @@ return view.extend({
                                        section_id,
                                        "dnsmasq_instance"
                                );
-                               switch (val) {
-                                       case "*":
-                                       case "-":
-                                               return val;
-                                       default:
-                                               return "+";
-                               }
+                               if (val && val[0]) {
+                                       switch (val[0]) {
+                                               case "*":
+                                               case "-":
+                                                       return val[0];
+                                               default:
+                                                       return "+";
+                                       }
+                               } else return "*";
                        };
                        o.write = function (section_id, formvalue) {
                                L.uci.set(pkg.Name, section_id, "dnsmasq_instance", formvalue);
@@ -270,13 +272,15 @@ return view.extend({
                                        section_id,
                                        "smartdns_instance"
                                );
-                               switch (val) {
-                                       case "*":
-                                       case "-":
-                                               return val;
-                                       default:
-                                               return "+";
-                               }
+                               if (val && val[0]) {
+                                       switch (val[0]) {
+                                               case "*":
+                                               case "-":
+                                                       return val[0];
+                                               default:
+                                                       return "+";
+                                       }
+                               } else return "*";
                        };
                        o.write = function (section_id, formvalue) {
                                L.uci.set(pkg.Name, section_id, "smartdns_instance", formvalue);