From 1f4606e48a56a80e172ed1fc23014872d27a5bfd Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Wed, 23 Nov 2016 21:21:21 +0900 Subject: [PATCH] AP_NavEKF2: protect against null beacon --- libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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();