Skip to content

Commit

Permalink
fix runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Dec 1, 2021
1 parent 018ee6b commit 98dc396
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* `FIX` [#825](https://github.com/sumneko/lua-language-server/issues/825)
* `FIX` [#827](https://github.com/sumneko/lua-language-server/issues/827)
* `FIX` [#837](https://github.com/sumneko/lua-language-server/issues/837)
* `FIX` runtime errors

## 2.5.1
`2021-11-29`
Expand Down
3 changes: 3 additions & 0 deletions script/core/definition.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ return function (uri, offset)
or src.type == 'setindex'
or src.type == 'tableindex' then
src = src.index
if not src then
goto CONTINUE
end
if not guide.isLiteral(src) then
goto CONTINUE
end
Expand Down
3 changes: 3 additions & 0 deletions script/core/diagnostics/unused-function.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ return function (uri, callback)
local cache = {}
---@async
local function checkFunction(source)
if not source then
return
end
if cache[source] ~= nil then
return cache[source]
end
Expand Down
4 changes: 4 additions & 0 deletions script/core/infer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ function m.searchAndViewInfers(source, field, mark)
end
local infers = m.searchInfers(source, field, mark)
local view = m.viewInfers(infers)
if type(view) == 'boolean' then
log.error('Why view is boolean?', util.dump(infers))
return 'any'
end
return view
end

Expand Down
3 changes: 3 additions & 0 deletions script/core/reference.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ return function (uri, position)
elseif src.type == 'table' and src.parent.type ~= 'return' then
goto CONTINUE
end
if not src then
goto CONTINUE
end
results[#results+1] = {
target = src,
uri = root.uri,
Expand Down

0 comments on commit 98dc396

Please sign in to comment.