Check if callsign is None before releasing to handle scenario where callsign was never generated correctly (#3510)

This PR is a workaround for modules where the standard callsigns (Ford,
Uzi etc) are not supported. Callsigns are not generated correctly and a
crash occurs when trying to release them if a package is released.
This commit is contained in:
zhexu14 2025-06-14 18:15:48 +10:00 committed by GitHub
parent 6da9dc7a49
commit 9baebeebf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -312,9 +312,12 @@ class AtoModel(QAbstractListModel):
index = self.ato.packages.index(package)
self.beginRemoveRows(QModelIndex(), index, index)
for flight in package.flights:
self.game_model.game.blue.callsign_generator.release_callsign(
flight.callsign
)
# Check if flight.callsign is None to handle case where callsign was not generated.
# This can happen when a module does not support the standard callsigns e.g. Kiowa.
if flight.callsign is not None:
self.game_model.game.blue.callsign_generator.release_callsign(
flight.callsign
)
self.ato.remove_package(package)
self.endRemoveRows()
# noinspection PyUnresolvedReferences