luci-mod-network: wireless.js: fix null access on failing iwinfo calls
authorJo-Philipp Wich <jo@mein.io>
Tue, 15 Oct 2019 16:42:04 +0000 (18:42 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 15 Oct 2019 16:42:04 +0000 (18:42 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index e200e438a0fd7b0fc108f5889e46d8d898300000..194b2a3df9d20799446e0f82f2c656e8a6099d3b 100644 (file)
@@ -226,7 +226,7 @@ var CBIWifiFrequencyValue = form.Value.extend({
                                '11a': L.hasSystemFeature('hostapd', 'acs') ? [ 'auto', 'auto', true ] : []
                        };
 
-                       for (var i = 0; Array.isArray(data[1]) && i < data[1].length; i++)
+                       for (var i = 0; i < data[1].length; i++)
                                this.channels[(data[1][i].mhz > 2484) ? '11a' : '11g'].push(
                                        data[1][i].channel,
                                        '%d (%d Mhz)'.format(data[1][i].channel, data[1][i].mhz),
@@ -286,7 +286,7 @@ var CBIWifiFrequencyValue = form.Value.extend({
                        if (vals[i+2])
                                sel.add(E('option', { value: vals[i+0] }, [ vals[i+1] ]));
 
-               if (!isNaN(vals.selected))
+               if (vals && !isNaN(vals.selected))
                        sel.selectedIndex = vals.selected;
 
                sel.parentNode.style.display = (sel.options.length <= 1) ? 'none' : '';