From 64ae52438b2a8516c436b7d8b0bca80a5f824679 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Tue, 11 Oct 2022 22:08:29 +0100 Subject: [PATCH] Fix uninitialized variable valgrind warning --- src/Scenery/terrain_stg.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Scenery/terrain_stg.cxx b/src/Scenery/terrain_stg.cxx index f4e2ada64..4e6bb7d73 100644 --- a/src/Scenery/terrain_stg.cxx +++ b/src/Scenery/terrain_stg.cxx @@ -365,16 +365,17 @@ bool FGStgTerrain::scenery_available(const SGGeod& position, double range_m) { if( schedule_scenery(position, range_m, 0.0) ) { - double elev; + double elev = 0.0; bool use_vpb = globals->get_props()->getNode("scenery/use-vpb")->getBoolValue(); + bool got_elev = get_elevation_m(SGGeod::fromGeodM(position, SG_MAX_ELEVATION_M), elev, 0, 0); - if (!use_vpb && !get_elevation_m(SGGeod::fromGeodM(position, SG_MAX_ELEVATION_M), elev, 0, 0)) + if (!use_vpb && !got_elev) { SG_LOG(SG_TERRAIN, SG_DEBUG, "FGStgTerrain::scenery_available - false" ); return false; } - + SGVec3f p = SGVec3f::fromGeod(SGGeod::fromGeodM(position, elev)); osg::FrameStamp* framestamp = globals->get_renderer()->getFrameStamp();