mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fixes shorten string called with not number value (#7259)
This commit is contained in:
parent
69e4ebc852
commit
d4fe237404
2 changed files with 14 additions and 8 deletions
|
|
@ -402,6 +402,12 @@ function shortenString(name, max_len)
|
|||
if(max_len == nil) then max_len = 24 end
|
||||
end
|
||||
|
||||
-- Error, max_len is not a number, print an error and return the name
|
||||
if not tonumber(max_len) then
|
||||
traceError(TRACE_DEBUG, TRACE_CONSOLE, "Length parameter is not a number.")
|
||||
tprint(debug.traceback())
|
||||
return name
|
||||
end
|
||||
if(string.len(name) < max_len + 1 --[[ The space taken by the ellipsis --]]) then
|
||||
return(name)
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue