Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

branch_list: Bail in case of missing worktrees.

Piotr Osiewiczc6195e617605
diff --git a/crates/vcs_menu/src/lib.rs b/crates/vcs_menu/src/lib.rs
index 8b6a4da9f09..f363f949830 100644
--- a/crates/vcs_menu/src/lib.rs
+++ b/crates/vcs_menu/src/lib.rs
@@ -106,12 +106,14 @@ impl PickerDelegate for BranchListDelegate {
.read_with(&mut cx, |view, cx| {
let delegate = view.delegate();
let project = delegate.workspace.read(cx).project().read(&cx);
- let mut cwd =
- project
+
+ let Some(worktree) = project
.visible_worktrees(cx)
.next()
- .unwrap()
- .read(cx)
+ else {
+ bail!("Cannot update branch list as there are no visible worktrees")
+ };
+ let mut cwd = worktree .read(cx)
.abs_path()
.to_path_buf();
cwd.push(".git");