luci-mod-admin-full: properly skip over unused switch ports
authorJo-Philipp Wich <jo@mein.io>
Thu, 18 Aug 2016 08:02:51 +0000 (10:02 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 18 Aug 2016 08:02:53 +0000 (10:02 +0200)
Fix incomplete port status display on vlan setup page when ports in the middle
are not used, e.g. some Lantiq boards use ports 0, 1, 2 and 4 for LAN ports so
JS code should not attempt to reference an undefined status element for port 3.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm

index f740a4a..96fbffd 100644 (file)
@@ -17,6 +17,9 @@
                                        {
                                                var th = document.getElementById('portstatus-' + switches[i] + '-' + j);
 
                                        {
                                                var th = document.getElementById('portstatus-' + switches[i] + '-' + j);
 
+                                               if (!th)
+                                                       continue;
+
                                                if (ports[j].link)
                                                {
                                                        th.innerHTML = String.format(
                                                if (ports[j].link)
                                                {
                                                        th.innerHTML = String.format(