Equals now checks for NULLs

release/4.3a0
Frank Dellaert 2009-10-25 14:25:17 +00:00
parent f54ba387fe
commit 57bc102548
1 changed files with 6 additions and 2 deletions

View File

@ -108,9 +108,13 @@ namespace gtsam {
if (factors_.size() != fg.size()) return false;
/** check whether the factors_ are the same */
for (size_t i = 0; i < factors_.size(); i++)
for (size_t i = 0; i < factors_.size(); i++) {
// TODO: Doesn't this force order of factor insertion?
if (!factors_[i]->equals(*fg.factors_[i], tol)) return false;
shared_factor f1 = factors_[i], f2 = fg.factors_[i];
if (f1==NULL && f2==NULL) continue;
if (f1==NULL || f2==NULL) return false;
if (!f1->equals(*f2, tol)) return false;
}
return true;
}