From e1858b14b60951eb39e47983eac86d53c7633a13 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Mon, 27 Dec 2010 14:24:44 +0100 Subject: [PATCH] GlobalWeather: don't crash Don't crash when flying into METAR generated weather reporting fog/mist/haze and clear sky --- src/Environment/metarproperties.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Environment/metarproperties.cxx b/src/Environment/metarproperties.cxx index 2f6cac2be..9582c9ee6 100644 --- a/src/Environment/metarproperties.cxx +++ b/src/Environment/metarproperties.cxx @@ -280,7 +280,7 @@ void MetarProperties::set_metar( const char * metar ) if( coverage != SGMetarCloud::COVERAGE_NIL ) { // if there is a layer above the fog, limit the top to one foot below that layer's bottom - if( metarClouds[0].getCoverage() != SGMetarCloud::COVERAGE_CLEAR ) + if( metarClouds.size() > 0 && metarClouds[0].getCoverage() != SGMetarCloud::COVERAGE_CLEAR ) thickness = metarClouds[0].getAltitude_ft() - LAYER_BOTTOM_STATION_OFFSET - 1; SGPropertyNode_ptr layerNode = cloudsNode->getChild(LAYER, 0, true ); -- 2.39.5