From 17cda52fc7d99cffd9a748efea87b9df10562f4b Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Sat, 19 Oct 2024 16:39:49 +0200 Subject: Minor inf fix --- wireshark/ndpi.lua | 4 ++++ 1 file changed, 4 insertions(+) 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" -- cgit v1.2.3