From dd3f387f5719fd73f522de7f5bf9ac6e5f3d7be8 Mon Sep 17 00:00:00 2001
From: joanvallve <jvallve@iri.upc.edu>
Date: Mon, 29 Mar 2021 09:53:26 +0200
Subject: [PATCH] hotfix

---
 src/processor/processor_motion.cpp | 3 +--
 test/gtest_processor_motion.cpp    | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp
index 894507c17..11dee8587 100644
--- a/src/processor/processor_motion.cpp
+++ b/src/processor/processor_motion.cpp
@@ -60,7 +60,6 @@ void ProcessorMotion::mergeCaptures(CaptureMotionConstPtr cap_prev,
 {
     assert(cap_prev != nullptr);
     assert(cap_target != nullptr);
-    assert(cap_target->getOriginCapture() != nullptr);
     assert(cap_prev == cap_target->getOriginCapture() && "merging not consecutive capture motions");
 
     // add prev buffer (discarding the first zero motion)
@@ -88,7 +87,7 @@ void ProcessorMotion::mergeCaptures(CaptureMotionConstPtr cap_prev,
     }
 
     // emplace new feature and factor (if origin has frame)
-    if (cap_prev->getOriginCapture()->getFrame())
+    if (cap_prev->getOriginCapture() and cap_prev->getOriginCapture()->getFrame())
     {
         auto new_feature = emplaceFeature(cap_target);
         emplaceFactor(new_feature, cap_prev->getOriginCapture());
diff --git a/test/gtest_processor_motion.cpp b/test/gtest_processor_motion.cpp
index e531defd5..92bf678d4 100644
--- a/test/gtest_processor_motion.cpp
+++ b/test/gtest_processor_motion.cpp
@@ -315,7 +315,7 @@ TEST_F(ProcessorMotion_test, mergeCaptures)
     FrameBasePtr     F_target = problem->emplaceFrame(t_target);
     CaptureMotionPtr C_source = std::dynamic_pointer_cast<CaptureMotion>(processor->getLast());
     CaptureMotionPtr C_target = CaptureBase::emplace<CaptureMotion>(F_target,
-                                                                    "ODOM 2d",
+                                                                    "CaptureOdom2d",
                                                                     t_target,
                                                                     sensor,
                                                                     data,
-- 
GitLab