From 3736d7341320db774ed95b41a5397cc2bfa31bf2 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Mon, 12 Jul 2010 20:20:24 +0000 Subject: [PATCH] "Correct" way of checking for non-existent items in SymbolMap --- inference/BayesTree-inl.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/inference/BayesTree-inl.h b/inference/BayesTree-inl.h index 9fb33572f..63e511d1a 100644 --- a/inference/BayesTree-inl.h +++ b/inference/BayesTree-inl.h @@ -600,16 +600,15 @@ namespace gtsam { BayesNet& bn, typename BayesTree::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); + } + } } /* ************************************************************************* */