From 9f0e191505e559e28a438297920c920276a0229c Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 8 May 2024 22:14:23 +1000 Subject: [PATCH] GCS_MAVLink: deny attempt to do partial upload while mission transfer in progress fixes an internal error where we make sure resources are not allocated before allocating upload resources. The user may receive a DENIED message if they move a waypoint before an item has been transfered to the vehicle. --- libraries/GCS_MAVLink/MissionItemProtocol.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libraries/GCS_MAVLink/MissionItemProtocol.cpp b/libraries/GCS_MAVLink/MissionItemProtocol.cpp index 4e0ba9d16bc54..bf42339d124a6 100644 --- a/libraries/GCS_MAVLink/MissionItemProtocol.cpp +++ b/libraries/GCS_MAVLink/MissionItemProtocol.cpp @@ -220,6 +220,19 @@ void MissionItemProtocol::handle_mission_write_partial_list(GCS_MAVLINK &_link, const mavlink_message_t &msg, const mavlink_mission_write_partial_list_t &packet) { + if (!mavlink2_requirement_met(_link, msg)) { + return; + } + + if (receiving) { + // someone is already uploading a mission. Deny ability to + // write a partial list here as they might be trying to + // overwrite a subset of the waypoints which the current + // transfer is uploading, and that may lead to storing a whole + // bunch of empty items. + send_mission_ack(_link, msg, MAV_MISSION_DENIED); + return; + } // start waypoint receiving if ((unsigned)packet.start_index > item_count() ||