Avoid bug when replacement stop at end of string

Detect when we are past the end of the string to avoid by
checking if byte is not nil.

Fix #510.
This commit is contained in:
Francesco Abbate 2021-09-10 14:55:04 +02:00
parent afd0672197
commit 218999dff8
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@ end
-- Moves to the end of the identified character. -- Moves to the end of the identified character.
local function end_character(str, index) local function end_character(str, index)
local byte = string.byte(str, index + 1) local byte = string.byte(str, index + 1)
while byte >= 128 and byte < 192 do while byte and byte >= 128 and byte < 192 do
index = index + 1 index = index + 1
byte = string.byte(str, index + 1) byte = string.byte(str, index + 1)
end end