Avoid zero-division exception

This commit is contained in:
Raffson 2023-08-16 19:08:04 +02:00
parent 789806637c
commit 4901443b7a
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -302,6 +302,9 @@ class FlightPlanBuilder:
else: else:
return "-" return "-"
if (waypoint.tot - last_time).total_seconds() == 0.0:
return "-"
speed = mps( speed = mps(
self.last_waypoint.position.distance_to_point(waypoint.position) self.last_waypoint.position.distance_to_point(waypoint.position)
/ (waypoint.tot - last_time).total_seconds() / (waypoint.tot - last_time).total_seconds()