fixed bug with null factors in GaussianFactorGraphs

release/4.3a0
Luca 2014-02-12 16:15:52 -05:00
parent c9ead8bbd3
commit b89c33977a
1 changed files with 4 additions and 2 deletions

View File

@ -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;
}