diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 04ed42f463..430974e57d 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -1149,7 +1149,13 @@ public: bool install_alternative_protocol(mavlink_channel_t chan, GCS_MAVLINK::protocol_handler_fn_t handler); // get the VFR_HUD throttle - int16_t get_hud_throttle(void) const { return num_gcs()>0?chan(0)->vfr_hud_throttle():0; } + int16_t get_hud_throttle(void) const { + const GCS_MAVLINK *link = chan(0); + if (link == nullptr) { + return 0; + } + return link->vfr_hud_throttle(); + } // update uart pass-thru void update_passthru();