Skip to content

Commit

Permalink
Nil protection
Browse files Browse the repository at this point in the history
  • Loading branch information
seud0nym committed Feb 21, 2023
1 parent 7e04d39 commit 5d3f71b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ for _,p in ipairs(proxy.getPN("uci.dhcp.host.",true)) do
local json = curl:read("*a")
local devices = dkjson.decode(json)
curl:close()
ap = gsub(ap,"_"," ")
for _,v in ipairs(devices) do
agentSTA[untaint(v.mac)] = format("%s - %s",ap,v.radio)
remoteSTAs = remoteSTAs + 1
if devices then
ap = gsub(ap,"_"," ")
for _,v in ipairs(devices) do
agentSTA[untaint(v.mac)] = format("%s - %s",ap,v.radio)
remoteSTAs = remoteSTAs + 1
end
end
else
ngx.log(ngx.ERR,cmd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function M.getDevicesCardHTML(all)
local json = curl:read("*a")
local devices = dkjson.decode(json)
curl:close()
nAPDevices = nAPDevices + #devices
nAPDevices = nAPDevices + (#devices or 0)
else
ngx.log(ngx.ERR,format("curl -qsklm1 --connect-timeout 1 http://%s:59595",ipv4[1].value))
end
Expand Down

0 comments on commit 5d3f71b

Please sign in to comment.