From 9c150252aa2b5b7645d765ab2b672e737cd29ddb Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Fri, 14 Jul 2023 19:00:14 +0200 Subject: [PATCH] branch_list: Ensure index is within list bounds. Z-2630 --- crates/vcs_menu/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/vcs_menu/src/lib.rs b/crates/vcs_menu/src/lib.rs index d4d0a3d187..8b6a4da9f0 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>) { 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| {