diff options
author | Marius Kintel <marius@kintel.net> | 2013-05-27 01:55:00 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-05-27 01:55:00 (GMT) |
commit | 0967a26bff45951d7b86fe628e8b1156e6e40ede (patch) | |
tree | fa72ca81652700a373023dace3a4163036ece20e /src/modcontext.cc | |
parent | 837b574351cdaddaebed6c4b0ba281b7e20c2a0f (diff) |
Support locating previously missing modules. yet another part of #364
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 |