applications/luci-splash: fix another crash in luci-splash when there were empty whitelist/blacklist sections

This commit is contained in:
Manuel Munz 2013-11-11 20:12:40 +00:00
parent 785211a974
commit e97596f42d

View file

@ -291,21 +291,28 @@ function get_known_macs(list)
local leased_macs = { } local leased_macs = { }
if not list or list == "lease" then if not list or list == "lease" then
uci:foreach("luci_splash_leases", "lease", function(s)
uci:foreach("luci_splash_leases", "lease", if s.mac then
function(s) leased_macs[s.mac:lower()] = true end) leased_macs[s.mac:lower()] = true
end
end)
end end
if not list or list == "whitelist" then if not list or list == "whitelist" then
uci:foreach("luci_splash", "whitelist", uci:foreach("luci_splash", "whitelist", function(s)
function(s) leased_macs[s.mac:lower()] = true end) if s.mac then
leased_macs[s.mac:lower()] = true
end
end)
end end
if not list or list == "blacklist" then if not list or list == "blacklist" then
uci:foreach("luci_splash", "blacklist", uci:foreach("luci_splash", "blacklist", function(s)
function(s) leased_macs[s.mac:lower()] = true end) if s.mac then
leased_macs[s.mac:lower()] = true
end
end)
end end
return leased_macs return leased_macs
end end