Avoid unwrap of Worktree::root_entry in resolve_path_in_worktrees (#16917)

It looks like this unwrap was introduced in
https://github.com/zed-industries/zed/pull/16534.

I think a worktree's `root_entry` can be null if it represents a
non-existent file that has not yet been saved. I hit a panic due to the
`unwrap` a couple of times on nightly.

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2024-08-26 14:01:56 -07:00 committed by GitHub
parent ef22372f0b
commit f417893a7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7706,7 +7706,7 @@ impl Project {
for candidate in candidates.iter() {
let path = worktree
.update(&mut cx, |worktree, _| {
let root_entry_path = &worktree.root_entry().unwrap().path;
let root_entry_path = &worktree.root_entry()?.path;
let resolved = resolve_path(&root_entry_path, candidate);