From fe8fc6dd24eafdafb9db12fbb74fa06c9c681b9b Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 5 Mar 2013 05:47:25 +0000 Subject: [PATCH] Fix in findScatterAndDims to ignore null factors instead of dereferencing them --- gtsam/linear/GaussianFactorGraph.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtsam/linear/GaussianFactorGraph.cpp b/gtsam/linear/GaussianFactorGraph.cpp index 5a78b35c7..c5443bb72 100644 --- a/gtsam/linear/GaussianFactorGraph.cpp +++ b/gtsam/linear/GaussianFactorGraph.cpp @@ -339,8 +339,10 @@ break; // First do the set union. BOOST_FOREACH(const GaussianFactor::shared_ptr& factor, factors) { - for(GaussianFactor::const_iterator variable = factor->begin(); variable != factor->end(); ++variable) { - scatter.insert(make_pair(*variable, SlotEntry(0, factor->getDim(variable)))); + if(factor) { + for(GaussianFactor::const_iterator variable = factor->begin(); variable != factor->end(); ++variable) { + scatter.insert(make_pair(*variable, SlotEntry(0, factor->getDim(variable)))); + } } }