From b89c33977a7222b94a6fd3651a780ffd6e174317 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 12 Feb 2014 16:15:52 -0500 Subject: [PATCH] fixed bug with null factors in GaussianFactorGraphs --- gtsam/linear/GaussianFactorGraph.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtsam/linear/GaussianFactorGraph.h b/gtsam/linear/GaussianFactorGraph.h index e12c892de..afb3a158b 100644 --- a/gtsam/linear/GaussianFactorGraph.h +++ b/gtsam/linear/GaussianFactorGraph.h @@ -138,8 +138,10 @@ namespace gtsam { /** unnormalized error */ double error(const VectorValues& x) const { double total_error = 0.; - BOOST_FOREACH(const sharedFactor& factor, *this) - total_error += factor->error(x); + BOOST_FOREACH(const sharedFactor& factor, *this){ + if(factor) + total_error += factor->error(x); + } return total_error; }