]> git.mxchange.org Git - flightgear.git/commitdiff
GlobalWeather: don't crash
authorTorsten Dreyer <Torsten@t3r.de>
Mon, 27 Dec 2010 13:24:44 +0000 (14:24 +0100)
committerTorsten Dreyer <Torsten@t3r.de>
Mon, 27 Dec 2010 13:24:44 +0000 (14:24 +0100)
Don't crash when flying into METAR generated weather
reporting fog/mist/haze and clear sky

src/Environment/metarproperties.cxx

index 2f6cac2be2525b01809f289190645f89ce11a9d9..9582c9ee66210a0b1d336fdbb6a1b7046e0e1588 100644 (file)
@@ -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 );