diff --git a/src/processor/processor_loopclosure_base.cpp b/src/processor/processor_loopclosure_base.cpp index 04408df13f3e1c801f8351f044eadd9c47d614fa..242f2b445bf2549c373b8b747cd4f34282192fad 100644 --- a/src/processor/processor_loopclosure_base.cpp +++ b/src/processor/processor_loopclosure_base.cpp @@ -34,8 +34,16 @@ void ProcessorLoopClosureBase::process(CaptureBasePtr _incoming_ptr) { CaptureBasePtr capture_1 = pairKC.second; CaptureBasePtr capture_2 = findLoopCandidate(capture_1); - if (capture_2==nullptr) return; - if (validateLoop(capture_1, capture_2)==false) return; + if (validateLoop(capture_1, capture_2)==false) return; + if (capture_2==nullptr) return; + if (capture_1->getFrame() == nullptr || capture_2->getFrame() == nullptr) { + WOLF_WARN("ProcessorLoopClosureBase : tried to close a loop with captures linked to no KF"); + return; + }; + if (capture_1->getFrame() == capture_2->getFrame()) { + WOLF_WARN("ProcessorLoopClosureBase : findLoopCandidate() returned two captures of the same frame"); + return; + }; createFactors(capture_1, capture_2); }; };