From 077b17f2b826585ac4e019f8c5903a92e93d39c5 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 25 Jul 2024 09:03:45 +1200 Subject: [PATCH] Gimbal: ignore invalid gimbal_device_id Otherwise, we potentially work with garbage. --- src/Gimbal/GimbalController.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Gimbal/GimbalController.cc b/src/Gimbal/GimbalController.cc index f019c04d95a..e9a72fb13b1 100644 --- a/src/Gimbal/GimbalController.cc +++ b/src/Gimbal/GimbalController.cc @@ -244,6 +244,11 @@ GimbalController::_handleGimbalDeviceAttitudeStatus(const mavlink_message_t& mes // If the gimbal_device_id field is set to 1-6, we must use this device id instead } else if (attitude_status.gimbal_device_id <= 6) { gimbal_device_id_or_compid = attitude_status.gimbal_device_id; + + // Otherwise, this is invalid and we don't know how to deal with it. + } else { + qCDebug(GimbalLog) << "_handleGimbalDeviceAttitudeStatus for invalid device id: " << attitude_status.gimbal_device_id << " from component id: " << message.compid; + return; } // We do a reverse lookup here