Changeset 6757

Show
Ignore:
Timestamp:
01/19/11 22:37:01 (2 years ago)
Author:
jow
Message:

libs/sys: fix luci.sys.wifi.channels()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/libs/sys/luasrc/sys.lua

    r6650 r6757  
    723723-- @return      Table of available channels 
    724724function wifi.channels(iface) 
    725     local t = iwinfo.type(iface or "") 
     725    local stat, iwinfo = pcall(require, "iwinfo") 
    726726    local cns 
    727     if iface and t and iwinfo[t] then 
    728         cns = iwinfo[t].freqlist(iface) 
     727 
     728    if stat then 
     729        local t = iwinfo.type(iface or "") 
     730        if iface and t and iwinfo[t] then 
     731            cns = iwinfo[t].freqlist(iface) 
     732        end 
    729733    end 
    730734