summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-10-19 11:27:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-10-19 11:27:48 +0800
commitcbb233f8725e580ee591302a82e672879e994036 (patch)
tree5493cfccfc6213ab43d86c61df6c8db263c8539f
parent0064ba13d1044e09c0af9eed7f265bf65b6e088b (diff)
downloadlua-language-server-cbb233f8725e580ee591302a82e672879e994036.zip
check nil
-rw-r--r--script/proto/converter.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/script/proto/converter.lua b/script/proto/converter.lua
index af75f080..2d3053b9 100644
--- a/script/proto/converter.lua
+++ b/script/proto/converter.lua
@@ -69,7 +69,7 @@ local function rawUnpackPosition(uri, position)
if text then
local lineOffset = state.lines[row]
local textOffset = utf8.offset(text, col + 1, lineOffset)
- if textOffset then
+ if textOffset and lineOffset then
col = textOffset - lineOffset
end
end
@@ -86,7 +86,7 @@ local function diffedUnpackPosition(uri, position)
if text then
local lineOffset = originLines[row]
local textOffset = utf8.offset(text, col + 1, lineOffset)
- if textOffset then
+ if textOffset and lineOffset then
col = textOffset - lineOffset
end
end