luci-mod-admin-full: avoid indexing iw.hwmodelist directly
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 15 Jan 2016 13:13:44 +0000 (14:13 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 18 Jan 2016 09:18:02 +0000 (10:18 +0100)
Prevent a nil field access when hwmodelist is undefined.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua

index 9a2bd5d2011ae3b5c4567df3e0d31a957747389f..c024164b881f4ccea370452436ef91740298acfa 100644 (file)
@@ -160,7 +160,7 @@ if found_sta then
                found_sta.channel, table.concat(found_sta.names, ", "))
 else
        ch = s:taboption("general", Value, "_mode_freq", '<br />'..translate("Operating frequency"))
-       ch.hwmodes = iw.hwmodelist
+       ch.hwmodes = hw_modes
        ch.freqlist = iw.freqlist
        ch.template = "cbi/wireless_modefreq"
 
@@ -174,7 +174,7 @@ else
 
        function ch.formvalue(self, section)
                return {
-                       m:formvalue(self:cbid(section) .. ".band") or (iw.hwmodelist.g and "11g" or "11a"),
+                       m:formvalue(self:cbid(section) .. ".band") or (hw_modes.g and "11g" or "11a"),
                        m:formvalue(self:cbid(section) .. ".channel") or "auto",
                        m:formvalue(self:cbid(section) .. ".htmode") or ""
                }