From e789553261bcba5b3a58ae3061a6e1dd41916d11 Mon Sep 17 00:00:00 2001 From: Luca Date: Sat, 15 Feb 2014 16:47:59 -0500 Subject: [PATCH] bug fix: hessianDiagonal seg-faulted with NULL factors --- .cproject | 32 ++++++---------------------- gtsam/linear/GaussianFactorGraph.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/.cproject b/.cproject index e6e040b97..6660ab682 100644 --- a/.cproject +++ b/.cproject @@ -1,19 +1,17 @@ - - - + - - + + @@ -62,13 +60,13 @@ - - + + @@ -118,13 +116,13 @@ - - + + @@ -2092,22 +2090,6 @@ true true - - make - -j5 - testSymmetricBlockMatrix.run - true - true - true - - - make - -j5 - testVerticalBlockMatrix.run - true - true - true - make -j5 diff --git a/gtsam/linear/GaussianFactorGraph.cpp b/gtsam/linear/GaussianFactorGraph.cpp index 766aceec6..873838918 100644 --- a/gtsam/linear/GaussianFactorGraph.cpp +++ b/gtsam/linear/GaussianFactorGraph.cpp @@ -200,8 +200,10 @@ namespace gtsam { VectorValues GaussianFactorGraph::hessianDiagonal() const { VectorValues d; BOOST_FOREACH(const sharedFactor& factor, *this) { - VectorValues di = factor->hessianDiagonal(); - d.addInPlace_(di); + if(factor){ + VectorValues di = factor->hessianDiagonal(); + d.addInPlace_(di); + } } return d; }