[Lua] Avoid infinite loop when creating empty string (#6614)

* [Lua] Avoid infinite loop when creating empty string

* [Lua] Check empty string output
This commit is contained in:
罗泽轩
2021-05-06 10:39:42 +08:00
committed by GitHub
parent 82aed82b84
commit a4bb8f0c2e
2 changed files with 20 additions and 1 deletions

View File

@@ -50,7 +50,10 @@ function mt:Slice(startPos, endPos)
-- updated the startPos based on the size of the
-- value
while startPos < endPos do
local v = d[startPos] or '/0'
local v = d[startPos]
if not v or v == "" then
v = '/0'
end
table.insert(b, v)
startPos = startPos + #v
end