Fixed nil host stats

This commit is contained in:
MatteoBiscosi 2021-08-03 18:01:19 +02:00
parent 6cd2121091
commit 8e22dd451e

View file

@ -4330,12 +4330,11 @@ function builMapHREF(host_address, vlan_id, map, default_page)
-- Getting stats and formatting initial href
if(stats == nil) then
if isMacAddress(host_address) then
if not isMacAddress(host_address) then
stats = interface.getHostMinInfo(host_address, vlan_id)
host = '<a href="'..ntop.getHttpPrefix()..'/lua/host_details.lua?host='..host_address
else
stats = interface.getMacInfo(host_address)
host = '<a href="'..ntop.getHttpPrefix()..'/lua/mac_details.lua?host='..host_address
end
cache[host_address] = { stats = stats }
@ -4343,6 +4342,12 @@ function builMapHREF(host_address, vlan_id, map, default_page)
stats = stats.stats
end
if not isMacAddress(host_address) then
host = '<a href="'..ntop.getHttpPrefix()..'/lua/host_details.lua?host='..host_address
else
host = '<a href="'..ntop.getHttpPrefix()..'/lua/mac_details.lua?host='..host_address
end
-- Adding vlan if present
if(vlan_id and (vlan_id ~= 0)) then
res = res .. "@"..vlan_id