diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-05-27 05:08:31 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-05-27 05:08:31 (GMT) |
commit | 37dc9342a14206f5862447eb9d3d5049ec67f638 (patch) | |
tree | 17e5a57dfa154821918094cab47476189771ce00 /src/modcontext.cc | |
parent | 6742ad55f4cf335fc767ab65784aab81e06b61d0 (diff) | |
parent | 0967a26bff45951d7b86fe628e8b1156e6e40ede (diff) |
Merge branch 'master' of github.com:openscad/openscad into issue125
Diffstat (limited to 'src/modcontext.cc')
-rw-r--r-- | src/modcontext.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modcontext.cc b/src/modcontext.cc index 3879811..3b957fd 100644 --- a/src/modcontext.cc +++ b/src/modcontext.cc @@ -125,7 +125,9 @@ Value FileContext::evaluate_function(const std::string &name, const EvalContext if (foundf) return foundf->evaluate(this, evalctx); BOOST_FOREACH(const FileModule::ModuleContainer::value_type &m, this->usedlibs) { - if (m.second->scope.functions.find(name) != m.second->scope.functions.end()) { + // m.second is NULL if the library wasn't be compiled (error or file-not-found) + if (m.second && + m.second->scope.functions.find(name) != m.second->scope.functions.end()) { FileContext ctx(*m.second, this->parent); ctx.initializeModule(*m.second); // FIXME: Set document path @@ -146,8 +148,9 @@ AbstractNode *FileContext::instantiate_module(const ModuleInstantiation &inst, c if (foundm) return foundm->instantiate(this, &inst, evalctx); BOOST_FOREACH(const FileModule::ModuleContainer::value_type &m, this->usedlibs) { - assert(m.second); - if (m.second->scope.modules.find(inst.name()) != m.second->scope.modules.end()) { + // m.second is NULL if the library wasn't be compiled (error or file-not-found) + if (m.second && + m.second->scope.modules.find(inst.name()) != m.second->scope.modules.end()) { FileContext ctx(*m.second, this->parent); ctx.initializeModule(*m.second); // FIXME: Set document path |