diff options
-rw-r--r-- | script/proto/converter.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/script/proto/converter.lua b/script/proto/converter.lua index 0cae230e..da0442fe 100644 --- a/script/proto/converter.lua +++ b/script/proto/converter.lua @@ -13,7 +13,11 @@ local function rawPackPosition(uri, pos) if text then local lineOffset = state.lines[row] if lineOffset then - col = utf8.len(text, lineOffset, lineOffset + col - 1, true) + local start = lineOffset + local finish = lineOffset + col - 1 + if start <= #text and finish <= #text then + col = utf8.len(text, lineOffset, lineOffset + col - 1, true) + end else col = 0 end |