<div dir="ltr"><div><div>[quick idea/suggestion] What about just doing ? :<br><br></div>if (val == null)<br></div> return;<br><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 22, 2014 at 3:47 AM, Álvaro Fernández Rojas <span dir="ltr"><<a href="mailto:noltari@gmail.com" target="_blank">noltari@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This fixes system/system not properly loading due to themes being null.<br>
<br>
Signed-off-by: Álvaro Fernández Rojas <<a href="mailto:noltari@gmail.com">noltari@gmail.com</a>><br>
---<br>
v3: follow conventions as stated by rmilecki<br>
v2: fix broken validation<br>
<br>
diff --git a/luci2/htdocs/luci2/luci2.js b/luci2/htdocs/luci2/luci2.js<br>
index 040f1e5..a2f10af 100644<br>
--- a/luci2/htdocs/luci2/luci2.js<br>
+++ b/luci2/htdocs/luci2/luci2.js<br>
@@ -5190,17 +5190,20 @@ function LuCI2()<br>
{<br>
delete validation.message;<br>
<br>
- if ((val.length == 0 && !d.opt))<br>
- {<br>
- rv = d.self.setError($elem, L.tr('Field must not be empty'));<br>
- }<br>
- else if (val.length > 0 && !vstack[0].apply(val, vstack[1]))<br>
- {<br>
- rv = d.self.setError($elem, validation.message, vstack[1]);<br>
- }<br>
- else<br>
- {<br>
- rv = d.self.setError($elem);<br>
+ if (val != null)<br>
+ {<br>
+ if ((val.length == 0 && !d.opt))<br>
+ {<br>
+ rv = d.self.setError($elem, L.tr('Field must not be empty'));<br>
+ }<br>
+ else if (val.length > 0 && !vstack[0].apply(val, vstack[1]))<br>
+ {<br>
+ rv = d.self.setError($elem, validation.message, vstack[1]);<br>
+ }<br>
+ else<br>
+ {<br>
+ rv = d.self.setError($elem);<br>
+ }<br>
}<br>
}<br>
<br>
_______________________________________________<br>
openwrt-devel mailing list<br>
<a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a><br>
<a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" target="_blank">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a><br>
</blockquote></div><br></div>