diff --git a/libraries/AC_AttitudeControl/AC_PosControl.cpp b/libraries/AC_AttitudeControl/AC_PosControl.cpp index 387b788d2b..faf3be9ad0 100644 --- a/libraries/AC_AttitudeControl/AC_PosControl.cpp +++ b/libraries/AC_AttitudeControl/AC_PosControl.cpp @@ -1197,7 +1197,7 @@ void AC_PosControl::check_for_ekf_z_reset() bool AC_PosControl::limit_vector_length(float& vector_x, float& vector_y, float max_length) { float vector_length = norm(vector_x, vector_y); - if ((vector_length > max_length) && is_positive(max_length)) { + if ((vector_length > max_length) && is_positive(vector_length)) { vector_x *= (max_length / vector_length); vector_y *= (max_length / vector_length); return true;