From 483ed19662b88cafce7c28c5dea2f09cc4372970 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Apr 2021 19:49:52 +1000 Subject: [PATCH] AP_OSD: change for AP::terrain as a pointer --- libraries/AP_OSD/AP_OSD_Screen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index 7b4b147580..4909c590ae 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -1934,10 +1934,10 @@ void AP_OSD_Screen::draw_vtx_power(uint8_t x, uint8_t y) #if AP_TERRAIN_AVAILABLE void AP_OSD_Screen::draw_hgt_abvterr(uint8_t x, uint8_t y) { - AP_Terrain &terrain = AP::terrain(); + AP_Terrain *terrain = AP::terrain(); float terrain_altitude; - if (terrain.height_above_terrain(terrain_altitude,true)) { + if (terrain != nullptr && terrain->height_above_terrain(terrain_altitude,true)) { backend->write(x, y, terrain_altitude < osd->warn_terr, "%4d%c", (int)u_scale(ALTITUDE, terrain_altitude), u_icon(ALTITUDE)); } else { backend->write(x, y, false, " ---%c", u_icon(ALTITUDE));