mirror of
https://github.com/mt-mods/led_marquee.git
synced 2024-11-30 19:13:47 +01:00
add check to prevent bad unicode from crashing the server
This commit is contained in:
parent
da1deecb4c
commit
db78e3dcdb
7
init.lua
7
init.lua
@ -128,7 +128,12 @@ local make_iso = function(s)
|
|||||||
local s2 = ""
|
local s2 = ""
|
||||||
while i <= string.len(s) do
|
while i <= string.len(s) do
|
||||||
if string.byte(s,i) > 159 then
|
if string.byte(s,i) > 159 then
|
||||||
s2 = s2..string.char(get_iso(string.sub(s, i, i+1)))
|
local ciso = get_iso(string.sub(s, i, i+1))
|
||||||
|
if ciso >= 0 and ciso < 256 then
|
||||||
|
s2 = s2..string.char(ciso)
|
||||||
|
else
|
||||||
|
s2 = s2..string.char(127)
|
||||||
|
end
|
||||||
i = i + 2
|
i = i + 2
|
||||||
else
|
else
|
||||||
s2 = s2..string.sub(s, i, i)
|
s2 = s2..string.sub(s, i, i)
|
||||||
|
Loading…
Reference in New Issue
Block a user