diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp index 2feac018be..a4e5f30493 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp +++ b/libraries/AP_RangeFinder/AP_RangeFinder_SITL.cpp @@ -35,7 +35,7 @@ void AP_RangeFinder_SITL::update(void) const float dist = AP::sitl()->get_rangefinder(_instance); // nan distance means nothing is connected - if (isnan(dist)) { + if (isnan(dist) || isinf(dist)) { state.status = RangeFinder::Status::NoData; return; }