summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-03-09 19:22:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-03-09 19:22:16 +0800
commit765c926aaf65229bb9ac2b7cb45b29355d71a56a (patch)
treef07ab30f32c8087446400bfdf9ae75035de2b244 /script/core
parentb660030001da95338f5cff021c9aaea0be2a3fd5 (diff)
downloadlua-language-server-765c926aaf65229bb9ac2b7cb45b29355d71a56a.zip
check nil
fix #1978
Diffstat (limited to 'script/core')
-rw-r--r--script/core/completion/auto-require.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/script/core/completion/auto-require.lua b/script/core/completion/auto-require.lua
index cec7139c..3139b911 100644
--- a/script/core/completion/auto-require.lua
+++ b/script/core/completion/auto-require.lua
@@ -56,9 +56,12 @@ function m.check(state, word, position, callback)
: gsub("(%p)", "%%%1")
: gsub("%%%?", "(.-)")
- stemName = relativePath
- : match(pattern)
- : match("[%a_][%w_]*$")
+ local stemPath = relativePath:match(pattern)
+ if not stemPath then
+ goto INNER_CONTINUE
+ end
+
+ stemName = stemPath:match("[%a_][%w_]*$")
if not stemName or testedStem[stemName] then
goto INNER_CONTINUE