fix: handle end value in suggest method to avoid panic on underflow

This commit is contained in:
Manuel Raimann
2026-01-31 11:44:33 +01:00
parent 9f3c0f0d3b
commit 6363540269
+1 -1
View File
@@ -60,7 +60,7 @@ impl SuggestableRange for Range<i64> {
fn suggest(self, trial: &mut Trial, name: String) -> Result<i64> {
// Range is exclusive on the end, so subtract 1
trial.suggest_int(name, self.start, self.end.saturating_sub(1))
trial.suggest_int(name, self.start, self.end.checked_sub(1).unwrap_or(self.end))
}
}