Fixes an error in community mode (due to NetworkInterfaceView removal)

WARNING: Script failure [/Users/simone/code/ntopng/scripts/lua/iface_hosts_list.lua][/Users/simone/code/ntopng/scripts/lua/modules/lua_utils.lua:164: attempt to get length of local 'h' (a nil value)]
This commit is contained in:
Simone Mainardi 2016-08-10 14:57:52 +02:00
parent 34dee98540
commit 9cf1866e2f

View file

@ -156,13 +156,25 @@ end
-- ##########################################
function aggregateHostsStats(hostStats)
-- method used to aggregate stats with interface views
-- hopefully now should be removed/short-circuited
if(hostStats == nil) then
return nil,0
else
local h = hostStats.hosts
local tot = #h
return h,tot
else
local h
local tot
if hostStats.hosts ~= nil then
h = hostStats.hosts
tot = hostStats.numHosts
else
h = hostStats
tot = 0
for k, v in pairs(hostStats) do
tot = tot + 1
end
end
return h,tot
end
end