Fix UI exception for custom flight plans.

(cherry picked from commit 1848338ef7b5020593e578694589fb7a3a74ad2f)
This commit is contained in:
Dan Albert 2020-12-12 18:27:30 -08:00
parent ff0446cc12
commit 25b72e1af4

View File

@ -76,6 +76,9 @@ class QFlightWaypointList(QTableView):
def takeoff_text(self, flight: Flight) -> str:
estimator = TotEstimator(self.package)
start_time = timedelta(seconds=int(
estimator.takeoff_time_for_flight(flight).total_seconds()))
takeoff_time = estimator.takeoff_time_for_flight(flight)
# Handle custom flight plans where we can't estimate the takeoff time.
if takeoff_time is None:
takeoff_time = timedelta()
start_time = timedelta(seconds=int(takeoff_time.total_seconds()))
return f"T+{start_time}"