Fix panic when no matches were found

This commit is contained in:
Antonio Scandurra 2022-01-29 18:21:19 +01:00
parent 969d81b632
commit c16bd98f56

View File

@ -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))),
}
}
}