]> git.mxchange.org Git - flightgear.git/commitdiff
Fix crash (use iterator of same container for loop)
authorThomas Geymayer <tomgey@gmail.com>
Thu, 12 Jun 2014 14:38:21 +0000 (16:38 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Thu, 12 Jun 2014 14:38:21 +0000 (16:38 +0200)
src/Main/fg_init.cxx

index b9c8833f02c2d65b5b04245e177e7e9ac9c2d8a8..40d041d252d302f845ba04c20a4586dc5663064f 100644 (file)
@@ -490,10 +490,12 @@ static void initAircraftDirsNasalSecurity()
 {
     SGPropertyNode* sim = fgGetNode("/sim", true);
     sim->removeChildren("fg-aircraft");
-    string_list::const_iterator it;
+
     int index = 0;
-    for (it = globals->get_aircraft_paths().begin();
-         it != globals->get_aircraft_paths().end(); ++it, ++index)
+    string_list const aircraft_paths = globals->get_aircraft_paths();
+    for( string_list::const_iterator it = aircraft_paths.begin();
+                                     it != aircraft_paths.end();
+                                   ++it, ++index )
     {
         SGPropertyNode* n = sim->getChild("fg-aircraft", index, true);
         n->setStringValue(*it);