AP_NavEKF3: fixed null dereference of airspeed

this caused a segfault in replay
This commit is contained in:
Andrew Tridgell 2020-12-11 12:48:00 +11:00
parent 2071a19a40
commit ac4a05ffbf

View File

@ -46,7 +46,7 @@ float NavEKF3_core::errorScore() const
// EKF less sensitive to innovations arising due events like strong gusts of wind, thus, prevent reporting high error scores
if (assume_zero_sideslip()) {
const auto *arsp = dal.airspeed();
if (arsp->get_num_sensors() >= 2 && (frontend->_affinity & EKF_AFFINITY_ARSP)) {
if (arsp != nullptr && arsp->get_num_sensors() >= 2 && (frontend->_affinity & EKF_AFFINITY_ARSP)) {
score = MAX(score, 0.3f * tasTestRatio);
}
}