aboutsummaryrefslogtreecommitdiff
path: root/wireshark/ndpi.lua
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2024-10-19 16:39:49 +0200
committerLuca Deri <deri@ntop.org>2024-10-20 18:40:49 +0200
commit17cda52fc7d99cffd9a748efea87b9df10562f4b (patch)
tree98a8835a8a43b45ef927181b799a3c82551c5d5f /wireshark/ndpi.lua
parent12a217d067c8bc012ea9e5ec32dd77f495f6011e (diff)
Minor inf fix
Diffstat (limited to 'wireshark/ndpi.lua')
-rw-r--r--wireshark/ndpi.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/wireshark/ndpi.lua b/wireshark/ndpi.lua
index c1758c03d..5372d9fa2 100644
--- a/wireshark/ndpi.lua
+++ b/wireshark/ndpi.lua
@@ -613,6 +613,8 @@ function round(num, idp)
end
function formatPctg(p)
+ if(p == nil) then p = 0 end
+
local p = round(p, 1)
if(p < 1) then return("< 1 %") end
@@ -2063,6 +2065,8 @@ local function ndpi_dialog_menu()
end
i = 0
+ if(tot == 0) then return end
+
for k,v in pairsByValues(ndpi_protos, rev) do
local pctg = formatPctg((v * 100) / tot)
label = label .. string.format("%-32s\t\t%s\t", k, bytesToSize(v)).. "\t["..pctg.."]\n"