Skip to content

Commit a7b53ae

Browse files
committed
better check for discrete factors
1 parent 6b3cb65 commit a7b53ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gtsam/hybrid/HybridGaussianFactorGraph.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ GaussianFactorGraph HybridGaussianFactorGraph::choose(
584584
DiscreteFactorGraph HybridGaussianFactorGraph::discreteFactors() const {
585585
DiscreteFactorGraph dfg;
586586
for (auto &&f : factors_) {
587-
auto discreteFactor = std::dynamic_pointer_cast<DiscreteFactor>(f);
588-
assert(discreteFactor);
589-
dfg.push_back(discreteFactor);
587+
if (auto discreteFactor = std::dynamic_pointer_cast<DiscreteFactor>(f)) {
588+
dfg.push_back(discreteFactor);
589+
}
590590
}
591591
return dfg;
592592
}

0 commit comments

Comments
 (0)