From 9604142d093db1500dc8da3ecd5a453f6cc28cdb Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Thu, 12 Jun 2014 16:38:21 +0200 Subject: [PATCH] Fix crash (use iterator of same container for loop) --- src/Main/fg_init.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index b9c8833f0..40d041d25 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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);