Fix segfault when showZero==false

release/4.3a0
Frank Dellaert 2022-01-04 18:40:08 -05:00
parent dcc74d827d
commit 541127f855
1 changed files with 2 additions and 3 deletions

View File

@ -261,9 +261,8 @@ namespace gtsam {
// Check if zero
if (!showZero) {
const Leaf* leaf = dynamic_cast<const Leaf*> (branch.get());
std::string value = valueFormatter(leaf->constant());
if (leaf && value.compare("0")) continue;
const Leaf* leaf = dynamic_cast<const Leaf*>(branch.get());
if (leaf && valueFormatter(leaf->constant()).compare("0")) continue;
}
os << "\"" << this->id() << "\" -> \"" << branch->id() << "\"";