diff --git a/libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp b/libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp index 768282440b..9e24803d44 100644 --- a/libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp +++ b/libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp @@ -658,6 +658,11 @@ void NavEKF2_core::readRngBcnData() // get the location of the beacon data const AP_Beacon *beacon = _ahrs->get_beacon(); + // exit immediately if no beacon object + if (beacon == nullptr) { + return; + } + // get the number of beacons in use N_beacons = beacon->count();