summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-15 20:47:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-15 20:47:48 +0800
commit241c518d2e02f2b65c59460d0bb8d4101d98614a (patch)
treeb3f5b965b94c380d160a42ae45e65b38ec96625c /script/core
parentf40f0a54b1b8ccb97bc30d21d16d4f212b178ada (diff)
downloadlua-language-server-241c518d2e02f2b65c59460d0bb8d4101d98614a.zip
check nil
Diffstat (limited to 'script/core')
-rw-r--r--script/core/diagnostics/duplicate-doc-alias.lua3
-rw-r--r--script/core/hover/table.lua2
2 files changed, 4 insertions, 1 deletions
diff --git a/script/core/diagnostics/duplicate-doc-alias.lua b/script/core/diagnostics/duplicate-doc-alias.lua
index 3df6f972..821bb1d8 100644
--- a/script/core/diagnostics/duplicate-doc-alias.lua
+++ b/script/core/diagnostics/duplicate-doc-alias.lua
@@ -17,6 +17,9 @@ return function (uri, callback)
for _, doc in ipairs(state.ast.docs) do
if doc.type == 'doc.alias' then
local name = guide.getKeyName(doc)
+ if not name then
+ return
+ end
if not cache[name] then
local docs = vm.getDocSets(uri, name)
cache[name] = {}
diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua
index 97ace24e..a80051b9 100644
--- a/script/core/hover/table.lua
+++ b/script/core/hover/table.lua
@@ -154,7 +154,7 @@ local function getNodeMap(fields, keyMap)
local nodeMap = {}
for _, field in ipairs(fields) do
local key = vm.getKeyName(field)
- if not keyMap[key] then
+ if not key or not keyMap[key] then
goto CONTINUE
end
await.delay()