diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-06-13 17:37:59 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-06-13 17:37:59 +0800 |
commit | e67c6b21a18d770a747ddd9712e53674c1f52044 (patch) | |
tree | ad4931e0c3c92b2b54030d91a3602be56c2dd0be | |
parent | b9b6d2167107d0f120dba115f858cdb052c42e73 (diff) | |
download | lua-language-server-e67c6b21a18d770a747ddd9712e53674c1f52044.zip |
check nil
-rw-r--r-- | script/core/diagnostics/incomplete-signature-doc.lua | 2 | ||||
-rw-r--r-- | script/core/diagnostics/missing-local-export-doc.lua | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/script/core/diagnostics/incomplete-signature-doc.lua b/script/core/diagnostics/incomplete-signature-doc.lua index 91f2db74..c030e7ad 100644 --- a/script/core/diagnostics/incomplete-signature-doc.lua +++ b/script/core/diagnostics/incomplete-signature-doc.lua @@ -59,7 +59,7 @@ return function (uri, callback) local functionName = source.parent[1] - if #source.args > 0 then + if source.args and #source.args > 0 then for _, arg in ipairs(source.args) do local argName = arg[1] if argName ~= 'self' then diff --git a/script/core/diagnostics/missing-local-export-doc.lua b/script/core/diagnostics/missing-local-export-doc.lua index 5825c115..f12e954f 100644 --- a/script/core/diagnostics/missing-local-export-doc.lua +++ b/script/core/diagnostics/missing-local-export-doc.lua @@ -10,6 +10,9 @@ local function findSetField(ast, name, callback) await.delay() if source.node[1] == name then local funcPtr = source.value.node + if not funcPtr then + return + end local func = funcPtr.value if funcPtr.type == 'local' and func.type == 'function' then helper.CheckFunction(func, callback, 'DIAG_MISSING_LOCAL_EXPORT_DOC_COMMENT', 'DIAG_MISSING_LOCAL_EXPORT_DOC_PARAM', 'DIAG_MISSING_LOCAL_EXPORT_DOC_RETURN') |