AP_Rangefinder: fix (very) out-of-range lidar causing float inf

This commit is contained in:
Tom Pittenger 2024-03-13 10:40:14 -07:00 committed by Tom Pittenger
parent 9feccd6671
commit 12f32707b3
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ void AP_RangeFinder_SITL::update(void)
const float dist = AP::sitl()->get_rangefinder(_instance); const float dist = AP::sitl()->get_rangefinder(_instance);
// nan distance means nothing is connected // nan distance means nothing is connected
if (isnan(dist)) { if (isnan(dist) || isinf(dist)) {
state.status = RangeFinder::Status::NoData; state.status = RangeFinder::Status::NoData;
return; return;
} }