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()