Skip to content

Commit

Permalink
Fix segfault when showZero==false
Browse files Browse the repository at this point in the history
  • Loading branch information
dellaert committed Jan 4, 2022
1 parent dcc74d8 commit 541127f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gtsam/discrete/DecisionTree-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() << "\"";
Expand Down

0 comments on commit 541127f

Please sign in to comment.