diff options
| -rw-r--r-- | src/parser.y | 20 | 
1 files changed, 9 insertions, 11 deletions
| diff --git a/src/parser.y b/src/parser.y index 958ef89..3dd933c 100644 --- a/src/parser.y +++ b/src/parser.y @@ -588,17 +588,15 @@ AbstractModule *parse(const char *text, const char *path, int debug)  	if (!module)  		return NULL; -	std::vector<std::string> to_erase; - -	BOOST_FOREACH(Module::ModuleContainer::value_type &m, module->usedlibs) { -		module->usedlibs[m.first] = Module::compile_library(m.first); -		if (!module->usedlibs[m.first]) { -			PRINTF("WARNING: Failed to compile library `%s'.", m.first.c_str()); -			to_erase.push_back( m.first ); -		} -	} -	BOOST_FOREACH( std::string s, to_erase ) { -		module->usedlibs.erase( s ); +        // Iterating manually since we want to modify the container while iterating +        Module::ModuleContainer::iterator iter = module->usedlibs.begin(); +        while (iter != module->usedlibs.end()) { +          Module::ModuleContainer::iterator curr = iter++; +          curr->second = Module::compile_library(curr->first); +          if (!curr->second) { +            PRINTF("WARNING: Failed to compile library `%s'.", curr->first.c_str()); +            module->usedlibs.erase(curr); +          }  	}  	parser_error_pos = -1; | 
