From 2eb28fffff0036fc29e8ea6308fe95a3d1977d37 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:10:26 -0600 Subject: [PATCH] Fix panic trying to go to next of 0 matches (cherry-pick #13233) (#13236) Cherry-picked Fix panic trying to go to next of 0 matches (#13233) Release Notes: - Fixed a panic when going to next search result when there are none Co-authored-by: Conrad Irwin --- crates/search/src/buffer_search.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 37c49f34ed1b8c611ac17d791732321b9b75b969..071cccc0a40dbe0caa0c16c84477326f43ae0af5 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -775,6 +775,7 @@ impl BufferSearchBar { if let Some(matches) = self .searchable_items_with_matches .get(&searchable_item.downgrade()) + .filter(|matches| !matches.is_empty()) { let new_match_index = searchable_item .match_index_for_direction(matches, index, direction, count, cx);