diff --git a/cpp/FactorGraph-inl.h b/cpp/FactorGraph-inl.h index f53c9970e..609e21944 100644 --- a/cpp/FactorGraph-inl.h +++ b/cpp/FactorGraph-inl.h @@ -118,7 +118,7 @@ void FactorGraph::replace(int index, sharedFactor factor) { if(factors_[index] != NULL) { // Remove this factor from its variables' index lists - BOOST_FOREACH(const Symbol& key, factor->keys()) { + BOOST_FOREACH(const Symbol& key, factors_[index]->keys()) { indices_.at(key).remove(index); } }