hastily avoid a div by zero [rebuild]

This commit is contained in:
Dustin Carlino 2020-03-07 11:43:39 -08:00
parent 727131145b
commit 92447785a1

View File

@ -1066,7 +1066,11 @@ fn trip_details(
d
};
// TODO Problems when this is really low?
let percent_duration = duration / total_duration_so_far;
let percent_duration = if total_duration_so_far == Duration::ZERO {
0.0
} else {
duration / total_duration_so_far
};
txt.add(Line(format!(
"- {}% of trip duration",
(100.0 * percent_duration) as usize