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
This commit is contained in:
Raffson 2023-01-13 21:19:42 +01:00
parent 0a3a56d4bc
commit 8b802a9cbc
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -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: