Skip to content

Commit

Permalink
fix(lsp): prevent 'attempt to index a nil value' error
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Dec 20, 2023
1 parent ddc6288 commit f158a58
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- SSR: Broken when command contains spaces [[#104](https://github.com/mrcjkb/rustaceanvim/issues/104)].
- LSP: Prevent "attempt to index a `nil` value" error [[#105](https://github.com/mrcjkb/rustaceanvim/issues/105)].

## [3.10.3] - 2023-12-19

Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local function get_mb_active_client_root(file_name)
for _, item in ipairs { toolchains, registry } do
if file_name:sub(1, #item) == item then
local clients = rust_analyzer.get_active_rustaceanvim_clients()
return clients[#clients].config.root_dir
return clients and #clients > 0 and clients[#clients].config.root_dir or nil
end
end
end
Expand Down

0 comments on commit f158a58

Please sign in to comment.