From a7b53aef0e5905d558560eab0fcb20db0832209e Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 4 Nov 2024 14:52:21 -0500 Subject: [PATCH] better check for discrete factors --- gtsam/hybrid/HybridGaussianFactorGraph.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gtsam/hybrid/HybridGaussianFactorGraph.cpp b/gtsam/hybrid/HybridGaussianFactorGraph.cpp index 049e6c38d2..b66847ca7a 100644 --- a/gtsam/hybrid/HybridGaussianFactorGraph.cpp +++ b/gtsam/hybrid/HybridGaussianFactorGraph.cpp @@ -584,9 +584,9 @@ GaussianFactorGraph HybridGaussianFactorGraph::choose( DiscreteFactorGraph HybridGaussianFactorGraph::discreteFactors() const { DiscreteFactorGraph dfg; for (auto &&f : factors_) { - auto discreteFactor = std::dynamic_pointer_cast(f); - assert(discreteFactor); - dfg.push_back(discreteFactor); + if (auto discreteFactor = std::dynamic_pointer_cast(f)) { + dfg.push_back(discreteFactor); + } } return dfg; }