diff --git a/src/factor/factor_base.cpp b/src/factor/factor_base.cpp index a0b4bc90005cb0ffa48c7ef21d87c758a7a52a36..429379fe922e7d1cd663f30b8fa9634f374ce3cd 100644 --- a/src/factor/factor_base.cpp +++ b/src/factor/factor_base.cpp @@ -315,17 +315,29 @@ void FactorBase::printHeader(int _depth, bool _constr_by, bool _metric, bool _st _stream << " Abs"; for (const auto& Fow : getFrameOtherList()) - if (!Fow.expired()) - _stream << " Frm" << Fow.lock()->id(); + { + auto Fow_sh = Fow.lock(); + if (Fow_sh) + _stream << " Frm" << Fow_sh->id(); + } for (const auto& Cow : getCaptureOtherList()) - if (!Cow.expired()) - _stream << " Cap" << Cow.lock()->id(); + { + auto Cow_sh = Cow.lock(); + if (Cow_sh) + _stream << " Cap" << Cow_sh->id(); + } for (const auto& fow : getFeatureOtherList()) - if (!fow.expired()) - _stream << " Ftr" << fow.lock()->id(); + { + auto fow_sh = fow.lock(); + if (fow_sh) + _stream << " Ftr" << fow_sh->id(); + } for (const auto& Low : getLandmarkOtherList()) - if (!Low.expired()) - _stream << " Lmk" << Low.lock()->id(); + { + auto Low_sh = Low.lock(); + if (Low_sh) + _stream << " Lmk" << Low_sh->id(); + } _stream << std::endl; }