From c765f5162f159a233c776e7288f68d440f81b326 Mon Sep 17 00:00:00 2001 From: Don Bright Date: Sun, 1 Jan 2012 21:30:39 -0600 Subject: fix crash bug rpt by nop head - 'use ' when x.scad doesnt exist diff --git a/src/parser.y b/src/parser.y index b0df50d..958ef89 100644 --- a/src/parser.y +++ b/src/parser.y @@ -588,13 +588,18 @@ AbstractModule *parse(const char *text, const char *path, int debug) if (!module) return NULL; - BOOST_FOREACH(Module::ModuleContainer::value_type &m, module->usedlibs) { + std::vector 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()); - module->usedlibs.erase(m.first); + to_erase.push_back( m.first ); } } + BOOST_FOREACH( std::string s, to_erase ) { + module->usedlibs.erase( s ); + } parser_error_pos = -1; return module; -- cgit v0.10.1