navd: check duration_typical before using (#27184)

check duration_typical

Co-authored-by: Kurt Nistelberger <kurt.nistelberger@gmail.com>
pull/27208/head
Kurt Nistelberger 2 years ago committed by GitHub
parent 74187463da
commit 9a42929b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      selfdrive/navd/navd.py

@ -226,6 +226,10 @@ class RouteEngine:
remaining = 1.0 - along_geometry / max(step['distance'], 1)
total_distance = step['distance'] * remaining
total_time = step['duration'] * remaining
if step['duration_typical'] is None:
total_time_typical = total_time
else:
total_time_typical = step['duration_typical'] * remaining
# Add up totals for future steps

Loading…
Cancel
Save