diff --git a/src/mavsdk/core/mavlink_command_sender.cpp b/src/mavsdk/core/mavlink_command_sender.cpp index 81017214a..177305125 100644 --- a/src/mavsdk/core/mavlink_command_sender.cpp +++ b/src/mavsdk/core/mavlink_command_sender.cpp @@ -88,6 +88,7 @@ void MavlinkCommandSender::queue_command_async( CommandIdentification identification = identification_from_command(command); + LockedQueue::Guard work_queue_guard(_work_queue); for (const auto& work : _work_queue) { if (work->identification == identification && callback == nullptr) { if (_command_debugging) { @@ -117,6 +118,7 @@ void MavlinkCommandSender::queue_command_async( CommandIdentification identification = identification_from_command(command); + LockedQueue::Guard work_queue_guard(_work_queue); for (const auto& work : _work_queue) { if (work->identification == identification && callback == nullptr) { if (_command_debugging) {