"Correct" way of checking for non-existent items in SymbolMap

release/4.3a0
Richard Roberts 2010-07-12 20:20:24 +00:00
parent 3d9ac5094b
commit 3736d73413
1 changed files with 8 additions and 9 deletions

View File

@ -600,16 +600,15 @@ namespace gtsam {
BayesNet<Conditional>& bn, typename BayesTree<Conditional>::Cliques& orphans) {
// process each key of the new factor
BOOST_FOREACH(const Symbol& key, keys)
try {
// get the clique
sharedClique clique = (*this)[key];
BOOST_FOREACH(const Symbol& key, keys) {
// remove path from clique to root
this->removePath(clique, bn, orphans);
} catch (std::invalid_argument e) {
}
// get the clique
typename Nodes::iterator clique(nodes_.find(key));
if(clique != nodes_.end()) {
// remove path from clique to root
this->removePath(clique->second, bn, orphans);
}
}
}
/* ************************************************************************* */