From 8b802a9cbc9a320c6da8602202e3c1a785e71407 Mon Sep 17 00:00:00 2001 From: Raffson Date: Fri, 13 Jan 2023 21:19:42 +0100 Subject: [PATCH] Fix issue in migrator when package has no flights Would cause an exception because `PackageWaypoints.create(p, c)` would call `package.departure_closest_to_target()` on its turn which raises a runtime exception if no flights are present. Makes total sense when you think about it... Fixes #66 --- game/migrator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/migrator.py b/game/migrator.py index d2821bef..2242e89d 100644 --- a/game/migrator.py +++ b/game/migrator.py @@ -40,7 +40,7 @@ class Migrator: def _update_packagewaypoints(self) -> None: for c in self.game.coalitions: for p in c.ato.packages: - if not hasattr(p.waypoints, "initial"): + if p.flights and not hasattr(p.waypoints, "initial"): p.waypoints = PackageWaypoints.create(p, c) def _update_package_attributes(self) -> None: