diff --git a/src/sensor/sensor_base.cpp b/src/sensor/sensor_base.cpp
index 064659074cb5db4c8dfddd63b802e1616491491b..09afa700e79e66b058df609ea004334bd0830e4b 100644
--- a/src/sensor/sensor_base.cpp
+++ b/src/sensor/sensor_base.cpp
@@ -274,7 +274,7 @@ CaptureBasePtr SensorBase::lastCapture(const TimeStamp& _ts) const
         {
             if ((*frame_rev_it)->getTimeStamp() <= _ts)
             {
-                CaptureBasePtr capture = (*frame_rev_it)->getCaptureOf(shared_from_this());
+                capture = (*frame_rev_it)->getCaptureOf(shared_from_this());
                 if (capture)
                     // found the most recent Capture made by this sensor !
                     break;