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:
parent
afd0672197
commit
218999dff8
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue