HAL_SITL: prevent FPE on zero range with optflow

This commit is contained in:
Andrew Tridgell 2015-06-25 10:08:41 +10:00
parent 14cf9b1621
commit a81590f7ac
1 changed files with 1 additions and 1 deletions

View File

@ -71,7 +71,7 @@ void SITL_State::_update_flow(void)
// estimate range to centre of image
float range;
if (rotmat.c.z > 0.05f) {
if (rotmat.c.z > 0.05f && height_agl() > 0) {
range = height_agl() / rotmat.c.z;
} else {
range = 1e38f;