summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArcanox <arcanox@arcanox.me>2021-09-25 18:01:10 -0500
committerArcanox <arcanox@arcanox.me>2021-09-25 18:01:10 -0500
commit052ceb3a61222eb525839d075fcf33cf9e7189c3 (patch)
treec0b420c9b92acea88dd48d2ac11c73b79003f3b1
parentdc685d1addad2f2e57f55a20bb6cca79c222c130 (diff)
downloadlua-language-server-052ceb3a61222eb525839d075fcf33cf9e7189c3.zip
Fix a crash when deleting lines from a file while anything is analyzing it (something might try and analyze beyond the new end of the file)
-rw-r--r--script/proto/converter.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/script/proto/converter.lua b/script/proto/converter.lua
index 19d592fe..0cae230e 100644
--- a/script/proto/converter.lua
+++ b/script/proto/converter.lua
@@ -12,7 +12,11 @@ local function rawPackPosition(uri, pos)
local text = files.getText(uri)
if text then
local lineOffset = state.lines[row]
- col = utf8.len(text, lineOffset, lineOffset + col - 1, true)
+ if lineOffset then
+ col = utf8.len(text, lineOffset, lineOffset + col - 1, true)
+ else
+ col = 0
+ end
end
end
return {