diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index b5119d33afa32b0430de23ab5ee907507bab8af4..68235b5285cc4fc0c4b25a051a46e7863cf46497 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -3729,7 +3729,8 @@ void Vehicle::clearAllParamMapRC(void) void Vehicle::sendJoystickDataThreadSafe(float roll, float pitch, float yaw, float thrust, quint16 buttons) { - if (_vehicleLinkManager->primaryLink()->linkConfiguration()->isHighLatency()) { + LinkInterface* pPrimaryLink = vehicleLinkManager()->primaryLink(); + if (pPrimaryLink == nullptr || pPrimaryLink->linkConfiguration()->isHighLatency()) { return; } @@ -3745,7 +3746,7 @@ void Vehicle::sendJoystickDataThreadSafe(float roll, float pitch, float yaw, flo mavlink_msg_manual_control_pack_chan( static_cast(_mavlink->getSystemId()), static_cast(_mavlink->getComponentId()), - vehicleLinkManager()->primaryLink()->mavlinkChannel(), + pPrimaryLink->mavlinkChannel(), &message, static_cast(_id), static_cast(newPitchCommand), @@ -3753,5 +3754,5 @@ void Vehicle::sendJoystickDataThreadSafe(float roll, float pitch, float yaw, flo static_cast(newThrustCommand), static_cast(newYawCommand), buttons); - sendMessageOnLinkThreadSafe(vehicleLinkManager()->primaryLink(), message); + sendMessageOnLinkThreadSafe(pPrimaryLink, message); }