Skip to content

Commit 5586af9

Browse files
AP_Baro: Check if origin alt is zero before using it as field elevation
1 parent babdb36 commit 5586af9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/AP_Baro/AP_Baro.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,9 @@ void AP_Baro::update_field_elevation(void)
10131013
is_zero(_field_elevation)) {
10141014
// auto-set based on origin
10151015
Location origin;
1016-
if (!armed && AP::ahrs().get_origin(origin)) {
1016+
if (!armed &&
1017+
AP::ahrs().get_origin(origin) &&
1018+
origin.alt) {
10171019
_field_elevation_active = origin.alt * 0.01;
10181020
new_field_elev = true;
10191021
}

0 commit comments

Comments
 (0)