mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-28 23:19:33 +00:00
Add input type check to split
This commit is contained in:
parent
3881dd3eea
commit
ae04b11250
1 changed files with 9 additions and 0 deletions
|
|
@ -557,6 +557,15 @@ function split(pString, pPattern)
|
|||
local Table = {} -- NOTE: use {n = 0} in Lua-5.0
|
||||
local fpat = "(.-)" .. pPattern
|
||||
local last_end = 1
|
||||
|
||||
-- input check
|
||||
if pString == nil then
|
||||
return Table
|
||||
end
|
||||
if type(pString) ~= "string" then
|
||||
pString = tostring(pString)
|
||||
end
|
||||
|
||||
local s, e, cap = pString:find(fpat, 1)
|
||||
while s do
|
||||
if s ~= 1 or cap ~= "" then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue