From 78d9a8cab8d059fe8226ab2cdc9517190dabd14b Mon Sep 17 00:00:00 2001 From: thduynguyen Date: Thu, 25 Sep 2014 11:18:51 -0400 Subject: [PATCH] fix empty factors bug --- gtsam/linear/GaussianFactorGraph.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gtsam/linear/GaussianFactorGraph.cpp b/gtsam/linear/GaussianFactorGraph.cpp index 91603f041..08c1352f5 100644 --- a/gtsam/linear/GaussianFactorGraph.cpp +++ b/gtsam/linear/GaussianFactorGraph.cpp @@ -305,6 +305,7 @@ VectorValues GaussianFactorGraph::gradientAtZero( // Zero-out the gradient VectorValues g; BOOST_FOREACH(const sharedFactor& factor, *this) { + if (!factor) continue; VectorValues gi = factor->gradientAtZero(negDuals); g.addInPlace_(gi); }