From fe5234694c66378115b82f4605b27a0850324d25 Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Wed, 7 Dec 2016 16:33:54 -0500 Subject: [PATCH] Adding a crash guard for when a command resend timeout occurs with an empty command queue. --- src/Vehicle/Vehicle.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 82afb8489..6f7bf3519 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -1838,6 +1838,12 @@ void Vehicle::sendMavCommand(int component, MAV_CMD command, bool showError, flo void Vehicle::_sendMavCommandAgain(void) { + if(!_mavCommandQueue.size()) { + qWarning() << "Command resend with no commands in queue"; + _mavCommandAckTimer.stop(); + return; + } + MavCommandQueueEntry_t& queuedCommand = _mavCommandQueue[0]; if (_mavCommandRetryCount++ > _mavCommandMaxRetryCount) { -- 2.22.0