Skip to content

Commit

Permalink
GCS_MAVLink: deny attempt to do partial upload while mission transfer…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
peterbarker committed May 15, 2024
1 parent 39bb63c commit 9f0e191
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libraries/GCS_MAVLink/MissionItemProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ||
Expand Down

0 comments on commit 9f0e191

Please sign in to comment.