Skip to content

Commit

Permalink
fix overflow crash when displaying ETA
Browse files Browse the repository at this point in the history
  • Loading branch information
conradoplg authored and djc committed Jun 27, 2023
1 parent 4ffc40e commit 1bf2cce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/format.rs
Expand Up @@ -77,7 +77,7 @@ impl fmt::Display for HumanDuration {
for (i, &(cur, _, _)) in UNITS.iter().enumerate() {
idx = i;
match UNITS.get(i + 1) {
Some(&next) if self.0 + next.0 / 2 >= cur + cur / 2 => break,
Some(&next) if self.0.saturating_add(next.0 / 2) >= cur + cur / 2 => break,
_ => continue,
}
}
Expand Down

0 comments on commit 1bf2cce

Please sign in to comment.