mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 12:53:35 +08:00
HomePos: check corresponding validity before using data
This commit is contained in:
@@ -329,14 +329,14 @@ void FlightTaskAuto::_set_heading_from_mode()
|
||||
break;
|
||||
|
||||
case 1: // Heading points towards home.
|
||||
if (_sub_home_position.get().valid_hpos) {
|
||||
if (_sub_home_position.get().valid_lpos) {
|
||||
v = Vector2f(&_sub_home_position.get().x) - Vector2f(_position);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2: // Heading point away from home.
|
||||
if (_sub_home_position.get().valid_hpos) {
|
||||
if (_sub_home_position.get().valid_lpos) {
|
||||
v = Vector2f(_position) - Vector2f(&_sub_home_position.get().x);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user