diff --git a/libraries/AP_Common/Location.cpp b/libraries/AP_Common/Location.cpp index 92a86ebc23..4ae650312f 100644 --- a/libraries/AP_Common/Location.cpp +++ b/libraries/AP_Common/Location.cpp @@ -355,9 +355,11 @@ bool Location::sanitize(const Location &defaultLoc) // convert relative alt=0 to mean current alt if (alt == 0 && relative_alt) { - relative_alt = false; - alt = defaultLoc.alt; - has_changed = true; + int32_t defaultLoc_alt; + if (defaultLoc.get_alt_cm(get_alt_frame(), defaultLoc_alt)) { + alt = defaultLoc_alt; + has_changed = true; + } } // limit lat/lng to appropriate ranges