mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-29 12:43:38 +03:00
hastily avoid a div by zero [rebuild]
This commit is contained in:
parent
727131145b
commit
92447785a1
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user