From b396f0a3e2f0046915a59f1e0f8ba5b8d33ae61a Mon Sep 17 00:00:00 2001
From: onefang
Date: Sat, 11 Apr 2020 13:17:39 +1000
Subject: Some more nil checks.
---
apt-panopticon-report-email-web.lua | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index 1cb74fd..3f80d03 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -28,7 +28,7 @@ local revDNS = function(hosts, dom, IP)
end
else
for k, v in pairs(hosts) do
- if APT.options.roundRobin.value ~= k then
+ if (APT.options.roundRobin.value ~= k) and (nil ~= v.IPs) then
local IPs = v.IPs
for i, u in pairs(IPs) do
if "table" == type(u) then
@@ -184,7 +184,7 @@ local DNSrrTest = function(hosts, k)
space = ' '
no = "no"
end
- if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) then
+ if (APT.options.roundRobin.value ~= k) and (nil ~= hosts[APT.options.roundRobin.value]) and (nil ~= hosts[k].IPs) then
APT.allpairs(hosts[k].IPs,
function(i, w, k, v)
if nil ~= hosts[APT.options.roundRobin.value].IPs["deb.roundr.devuan.org"][i] then
@@ -323,16 +323,18 @@ local makeIPlist = function(hosts)
hosts[k].Country = nil
hosts[k].Bandwidth = nil
- for l, w in pairs(hosts[k].IPs) do
- if type(w) == "table" then
- n[l] = {}
- for i, u in pairs(w) do
- local log = '[graphs] ' .. logCount(k, i)
- if "" == log then n[l][i] = u else n[l][log .. " " .. revDNS(hosts, k, i)] = u end
+ if nil ~= hosts[k].IPs then
+ for l, w in pairs(hosts[k].IPs) do
+ if type(w) == "table" then
+ n[l] = {}
+ for i, u in pairs(w) do
+ local log = '[graphs] ' .. logCount(k, i)
+ if "" == log then n[l][i] = u else n[l][log .. " " .. revDNS(hosts, k, i)] = u end
+ end
+ else
+ local log = '[graphs] ' .. logCount(k, l)
+ if "" == log then n[l] = w else n[log .. " " .. revDNS(hosts, k, l)] = w end
end
- else
- local log = '[graphs] ' .. logCount(k, l)
- if "" == log then n[l] = w else n[log .. " " .. revDNS(hosts, k, l)] = w end
end
end
m['[graphs] ' .. log .. " DNS entries -" .. redirs(hosts, k)] = n
--
cgit v1.1