Skip to content

Commit 765c926

Browse files
committed
check nil
fix #1978
1 parent b660030 commit 765c926

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* `FIX` [#1924]
1010
* `FIX` [#1928]
1111
* `FIX` [#1945]
12+
* `FIX` [#1978]
1213

1314
[#1715]: https://github.com/LuaLS/lua-language-server/issues/1715
1415
[#1753]: https://github.com/LuaLS/lua-language-server/issues/1753
@@ -17,6 +18,7 @@
1718
[#1924]: https://github.com/LuaLS/lua-language-server/issues/1924
1819
[#1928]: https://github.com/LuaLS/lua-language-server/issues/1928
1920
[#1945]: https://github.com/LuaLS/lua-language-server/issues/1945
21+
[#1978]: https://github.com/LuaLS/lua-language-server/issues/1978
2022

2123
## 3.6.13
2224
`2023-3-2`

script/core/completion/auto-require.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ function m.check(state, word, position, callback)
5656
: gsub("(%p)", "%%%1")
5757
: gsub("%%%?", "(.-)")
5858

59-
stemName = relativePath
60-
: match(pattern)
61-
: match("[%a_][%w_]*$")
59+
local stemPath = relativePath:match(pattern)
60+
if not stemPath then
61+
goto INNER_CONTINUE
62+
end
63+
64+
stemName = stemPath:match("[%a_][%w_]*$")
6265

6366
if not stemName or testedStem[stemName] then
6467
goto INNER_CONTINUE

0 commit comments

Comments
 (0)