From f417893a7b462af089af7bd6a49371a5148b2fb4 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 26 Aug 2024 14:01:56 -0700 Subject: [PATCH] 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 --- crates/project/src/project.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 24fa4e3ba8..b12029ba40 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -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);