Fix panic trying to go to next of 0 matches (cherry-pick #13233) (#13236)

gcp-cherry-pick-bot[bot] and Conrad Irwin created

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 <conrad.irwin@gmail.com>

Change summary

crates/search/src/buffer_search.rs | 1 +
1 file changed, 1 insertion(+)

Detailed changes

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);