From c16bd98f565f48f99e2ef311bfe2d71b36633764 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Sat, 29 Jan 2022 18:21:19 +0100 Subject: [PATCH] Fix panic when no matches were found --- crates/find/src/find.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/find/src/find.rs b/crates/find/src/find.rs index 4096abe03c..f1725d4b96 100644 --- a/crates/find/src/find.rs +++ b/crates/find/src/find.rs @@ -432,7 +432,7 @@ impl FindBar { Ordering::Equal } }) { - Ok(i) | Err(i) => Some(cmp::min(i, ranges.len() - 1)), + Ok(i) | Err(i) => Some(cmp::min(i, ranges.len().saturating_sub(1))), } } }