From 0e0b19c905d58f6795a57f8042a958a76dec7f60 Mon Sep 17 00:00:00 2001 From: Alexander Yakushev Date: Tue, 30 Nov 2010 07:32:37 +0200 Subject: Added a gag to prevent crashes on parsing errors --- utf8.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'utf8.lua') diff --git a/utf8.lua b/utf8.lua index 3db6642..72177c2 100644 --- a/utf8.lua +++ b/utf8.lua @@ -100,6 +100,10 @@ end -- instead of bytes function utf8sub (s, i, j) j = j or -1 + + if i == nil then + return "" + end local pos = 1 local bytes = string.len(s) -- cgit v1.2.3