Fixed scan error handling issue

The getScanInfo could return a false, which wasn’t handled properly
resulting in a error and the box sticking into connecting mode.
This commit is contained in:
peteruithoven 2014-04-28 16:41:31 +02:00
parent 2669ca2135
commit d1e35c1a69
1 changed files with 5 additions and 1 deletions

View File

@ -344,9 +344,13 @@ function M.associateSsid(ssid, passphrase, recreate)
-- if not, or if newly created configuration is requested, create a new configuration
if cfg == nil or recreate ~= nil then
local scanResult = wifi.getScanInfo(ssid)
local scanResult, msg = wifi.getScanInfo(ssid)
if scanResult ~= nil then
wifi.createConfigFromScanInfo(scanResult, passphrase)
elseif scanResult == false then
--check for error
M.setStatus(M.CONNECTING_FAILED,msg);
return nil,msg
else
--check for error
local msg = "Wireless network "..ssid.." is not available"