From c55eaeeb1d18fcf4fc44c372b3c6cd6d9f9be40a Mon Sep 17 00:00:00 2001 From: Peter Sadrozinski Date: Thu, 17 Oct 2013 22:51:07 -0400 Subject: [PATCH] Potential fix for airports that could generate FPE on simgear load --- src/Airports/GenAirports850/airport.cxx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index e506ffee..b79acb65 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -1079,19 +1079,23 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // for ( unsigned int i = 0; i < rwy_lights.size(); ++i ) for ( unsigned int i = 0; i < rwy_lights.size(); ++i ) { - pt_v.clear(); - pt_n.clear(); - for ( unsigned int j = 0; j < rwy_lights[i].ContourSize(); ++j ) + if ( rwy_lights[i].ContourSize() ) { - index = nodes.add( rwy_lights[i].GetPosition(j) ); - pt_v.push_back( index ); + pt_v.clear(); + pt_n.clear(); + for ( unsigned int j = 0; j < rwy_lights[i].ContourSize(); ++j ) + { + index = nodes.add( rwy_lights[i].GetPosition(j) ); + pt_v.push_back( index ); - index = normals.add( rwy_lights[i].GetNormal(j) ); - pt_n.push_back( index ); + index = normals.add( rwy_lights[i].GetNormal(j) ); + pt_n.push_back( index ); + } + + pts_v.push_back( pt_v ); + pts_n.push_back( pt_n ); + pt_materials.push_back( rwy_lights[i].GetType() ); } - pts_v.push_back( pt_v ); - pts_n.push_back( pt_n ); - pt_materials.push_back( rwy_lights[i].GetType() ); } // calculate node elevations