From c5ff8777be3e1b15196f2e8c1463d17c2a4fdee3 Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 12 Jun 2022 22:34:43 +0200 Subject: [PATCH] Fix Exception: 'DeadFlightPlan' object has no attribute 'targets' Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2247 --- .../mission/flight/waypoints/QFlightWaypointTab.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py b/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py index 55811bf9..bf79f925 100644 --- a/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py +++ b/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py @@ -98,9 +98,8 @@ class QFlightWaypointTab(QFrame): def on_delete_waypoint(self): waypoints = [] - for ( - selected_row - ) in self.flight_waypoint_list.selectionModel().selectedIndexes(): + selection = self.flight_waypoint_list.selectionModel() + for selected_row in selection.selectedIndexes(): if selected_row.row() > 0: waypoints.append(self.flight.flight_plan.waypoints[selected_row.row()]) for waypoint in waypoints: @@ -113,9 +112,10 @@ class QFlightWaypointTab(QFrame): # If the waypoint is a target waypoint and is not the last target # waypoint, we don't need to degrade. if isinstance(self.flight.flight_plan, FormationAttackFlightPlan): - is_target = waypoint in self.flight.flight_plan.targets - if is_target and len(self.flight.flight_plan.targets) > 1: - self.flight.flight_plan.targets.remove(waypoint) + is_target = waypoint in self.flight.flight_plan.target_area_waypoint.targets + count = len(self.flight.flight_plan.target_area_waypoint.targets) + if is_target and count > 1: + self.flight.flight_plan.target_area_waypoint.targets.remove(waypoint) return self.degrade_to_custom_flight_plan()