diff --git a/src/factor/factor_base.cpp b/src/factor/factor_base.cpp index 4e18cb47d8485a7b9ee83853e863ddf20bb7e78a..a0b4bc90005cb0ffa48c7ef21d87c758a7a52a36 100644 --- a/src/factor/factor_base.cpp +++ b/src/factor/factor_base.cpp @@ -151,20 +151,23 @@ void FactorBase::remove(bool viral_remove_empty_parent) CaptureBasePtr FactorBase::getCapture() const { - assert(getFeature() != nullptr && "calling getCapture before linking with a feature"); - return getFeature()->getCapture(); + auto ftr = getFeature(); + if (ftr != nullptr) return ftr->getCapture(); + else return nullptr; } FrameBasePtr FactorBase::getFrame() const { - assert(getCapture() != nullptr && "calling getFrame before linking with a capture"); - return getCapture()->getFrame(); + auto cpt = getCapture(); + if(cpt != nullptr) return cpt->getFrame(); + else return nullptr; } SensorBasePtr FactorBase::getSensor() const { - assert(getCapture() != nullptr && "calling getSensor before linking with a capture"); - return getCapture()->getSensor(); + auto cpt = getCapture(); + if(cpt != nullptr) return cpt->getSensor(); + else return nullptr; } void FactorBase::setStatus(FactorStatus _status)