summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/duplicate-set-field.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-28 20:06:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-28 20:06:34 +0800
commit5b950742705515c4bc2502e8a902221f44bf644f (patch)
treef57ba3f1159eecfba3d882703b1b5775e0e72541 /script/core/diagnostics/duplicate-set-field.lua
parentdeac4582d38908c1281d4d5215b7b69ff8400dca (diff)
downloadlua-language-server-5b950742705515c4bc2502e8a902221f44bf644f.zip
cleanup
Diffstat (limited to 'script/core/diagnostics/duplicate-set-field.lua')
-rw-r--r--script/core/diagnostics/duplicate-set-field.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/script/core/diagnostics/duplicate-set-field.lua b/script/core/diagnostics/duplicate-set-field.lua
index 8052c420..f5007eb1 100644
--- a/script/core/diagnostics/duplicate-set-field.lua
+++ b/script/core/diagnostics/duplicate-set-field.lua
@@ -48,10 +48,12 @@ return function (uri, callback)
local blocks = {}
for _, value in ipairs(values) do
local block = guide.getBlock(value)
- if not blocks[block] then
- blocks[block] = {}
+ if block then
+ if not blocks[block] then
+ blocks[block] = {}
+ end
+ blocks[block][#blocks[block]+1] = value
end
- blocks[block][#blocks[block]+1] = value
end
for _, defs in pairs(blocks) do
if #defs <= 1 then