summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-23 02:06:45 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-23 02:06:45 +0800
commitab171866489b903a74ab1da735ff5c35f78e9919 (patch)
treebf8f4106df985ad88ec57946686f08ee70797bac
parentc2fb1d5e889510f8175c25277587e7ea91fb2170 (diff)
downloadlua-language-server-ab171866489b903a74ab1da735ff5c35f78e9919.zip
check nil
-rw-r--r--script/core/diagnostics/cast-type-mismatch.lua2
-rw-r--r--script/core/diagnostics/unknown-cast-variable.lua2
2 files changed, 2 insertions, 2 deletions
diff --git a/script/core/diagnostics/cast-type-mismatch.lua b/script/core/diagnostics/cast-type-mismatch.lua
index ecee6a84..0561a8da 100644
--- a/script/core/diagnostics/cast-type-mismatch.lua
+++ b/script/core/diagnostics/cast-type-mismatch.lua
@@ -16,7 +16,7 @@ return function (uri, callback)
end
for _, doc in ipairs(state.ast.docs) do
- if doc.type == 'doc.cast' then
+ if doc.type == 'doc.cast' and doc.loc then
await.delay()
local defs = vm.getDefs(doc.loc)
local loc = defs[1]
diff --git a/script/core/diagnostics/unknown-cast-variable.lua b/script/core/diagnostics/unknown-cast-variable.lua
index cfa25ed8..57377f6e 100644
--- a/script/core/diagnostics/unknown-cast-variable.lua
+++ b/script/core/diagnostics/unknown-cast-variable.lua
@@ -16,7 +16,7 @@ return function (uri, callback)
end
for _, doc in ipairs(state.ast.docs) do
- if doc.type == 'doc.cast' then
+ if doc.type == 'doc.cast' and doc.loc then
await.delay()
local defs = vm.getDefs(doc.loc)
local loc = defs[1]