summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-27 18:46:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-27 18:46:44 +0800
commiteaf7ee99405e164ce660591e4b8d042b1a08411f (patch)
tree5cd011001b032907bb0be3f3f8b9c3ec2fac5e68 /script
parent65b58d9170324b2a09d8197e0526ae03102fdb5b (diff)
downloadlua-language-server-eaf7ee99405e164ce660591e4b8d042b1a08411f.zip
check nil
Diffstat (limited to 'script')
-rw-r--r--script/core/completion.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 347b1186..d27a32c5 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -66,6 +66,9 @@ local function findNearestTableField(state, position)
local text = files.getText(uri)
local offset = guide.positionToOffset(state, position)
local soffset = lookBackward.findAnyOffset(text, offset - 1)
+ if not soffset then
+ return nil
+ end
local symbol = text:sub(soffset, soffset)
if symbol == '}' then
return nil