From f08566603270c43de352f96f650a8593bf332c12 Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Fri, 20 May 2016 12:28:46 -0700 Subject: [PATCH] AP_Common: fix compile when using AP_TERRAIN_AVAILABLE 0 --- libraries/AP_Common/Location.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Common/Location.cpp b/libraries/AP_Common/Location.cpp index c2c0ec24f6..187416651a 100644 --- a/libraries/AP_Common/Location.cpp +++ b/libraries/AP_Common/Location.cpp @@ -128,13 +128,17 @@ bool Location_Class::get_alt_cm(ALT_FRAME desired_frame, int32_t &ret_alt_cm) co } // check for terrain altitude - float alt_terr_cm; + float alt_terr_cm = 0; if (frame == ALT_FRAME_ABOVE_TERRAIN || desired_frame == ALT_FRAME_ABOVE_TERRAIN) { +#if AP_TERRAIN_AVAILABLE if (_ahrs == NULL || _terrain == NULL || !_terrain->height_amsl(*(Location *)this, alt_terr_cm, true)) { return false; } // convert terrain alt to cm alt_terr_cm *= 100.0f; +#else + return false; +#endif } // convert alt to absolute