summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-21 14:53:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-21 14:53:42 +0800
commit0169983a752d55e2dc995b88b72badc74aa0f0ab (patch)
tree5edf7ed0f04ddf2d57dc81c3c5b9bf42e61de222 /script
parentb3c1757e7067ef47ffa83c66a7ea747187097593 (diff)
downloadlua-language-server-0169983a752d55e2dc995b88b72badc74aa0f0ab.zip
fix
Diffstat (limited to 'script')
-rw-r--r--script/core/highlight.lua2
-rw-r--r--script/core/searcher.lua3
2 files changed, 4 insertions, 1 deletions
diff --git a/script/core/highlight.lua b/script/core/highlight.lua
index d1f11906..759029c3 100644
--- a/script/core/highlight.lua
+++ b/script/core/highlight.lua
@@ -229,7 +229,7 @@ local function isLiteralValue(source)
if not guide.isLiteral(source) then
return false
end
- if source.parent.index == source then
+ if source.parent and source.parent.index == source then
return false
end
return true
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 3055a5f4..79b605b5 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -657,6 +657,9 @@ local function prepareSearch(source)
or source.type == 'method' then
source = source.parent
end
+ if not source then
+ return
+ end
local root = guide.getRoot(source)
noder.compileNodes(root)
local uri = guide.getUri(source)