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: Ensure index is within list bounds.

Piotr Osiewicz9c150252aa2b
diff --git a/crates/vcs_menu/src/lib.rs b/crates/vcs_menu/src/lib.rs
index d4d0a3d1872..8b6a4da9f09 100644
--- a/crates/vcs_menu/src/lib.rs
+++ b/crates/vcs_menu/src/lib.rs
@@ -182,7 +182,9 @@ impl PickerDelegate for BranchListDelegate {
fn confirm(&mut self, cx: &mut ViewContext<Picker<Self>>) {
let current_pick = self.selected_index();
- let current_pick = self.matches[current_pick].string.clone();
+ let Some(current_pick) = self.matches.get(current_pick).map(|pick| pick.string.clone()) else {
+ return;
+ };
cx.spawn(|picker, mut cx| async move {
picker
.update(&mut cx, |this, cx| {