From cb6c9d3bd54b9b4852c25ac28d7c46c27c788b9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Thu, 8 Mar 2018 08:34:16 +0100
Subject: [PATCH] Guard WOLF_DEBUG in case of nullptr

---
 src/problem.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/problem.cpp b/src/problem.cpp
index 63775a5ad..609f85a25 100644
--- a/src/problem.cpp
+++ b/src/problem.cpp
@@ -330,11 +330,18 @@ bool Problem::permitKeyFrame(ProcessorBasePtr _processor_ptr)
 
 void Problem::keyFrameCallback(FrameBasePtr _keyframe_ptr, ProcessorBasePtr _processor_ptr, const Scalar& _time_tolerance)
 {
-    WOLF_DEBUG((_processor_ptr->isMotion() ? "PM " : "PT "), _processor_ptr->getName(), ": KF", _keyframe_ptr->id(), " Callback emitted with ts = ", _keyframe_ptr->getTimeStamp());
+    if (_processor_ptr)
+    {
+        WOLF_DEBUG((_processor_ptr->isMotion() ? "PM " : "PT "), _processor_ptr->getName(), ": KF", _keyframe_ptr->id(), " Callback emitted with ts = ", _keyframe_ptr->getTimeStamp());
+    }
+    else
+    {
+        WOLF_DEBUG("External callback: KF", _keyframe_ptr->id(), " Callback emitted with ts = ", _keyframe_ptr->getTimeStamp());
+    }
 
     for (auto sensor : hardware_ptr_->getSensorList())
-    	for (auto processor : sensor->getProcessorList())
-    		if (processor && (processor != _processor_ptr) )
+        for (auto processor : sensor->getProcessorList())
+            if (processor && (processor != _processor_ptr) )
                 processor->keyFrameCallback(_keyframe_ptr, _time_tolerance);
 }
 
-- 
GitLab