diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp index c26e311f3a32574e2f87cfc47c558c39bd56f006..f78fea1a5e72bba4d1f3be5f519a454e7bf53dfd 100644 --- a/src/processor/processor_motion.cpp +++ b/src/processor/processor_motion.cpp @@ -388,7 +388,10 @@ VectorComposite ProcessorMotion::getState() const if (last_ptr_ == nullptr or last_ptr_->getFrame() == nullptr) // We do not have any info of where to find a valid state // Further checking here for origin_ptr is redundant: if last=null, then origin=null too. + { + WOLF_ERROR("Processor has no state. Returning an empty VectorComposite with no blocks"); return VectorComposite(); // return empty state + } // From here on, we do have info to compute a valid state @@ -461,7 +464,10 @@ VectorComposite ProcessorMotion::getState(const TimeStamp& _ts) const CaptureMotionPtr capture_motion = findCaptureContainingTimeStamp(_ts); if (capture_motion == nullptr) // we do not have any info of where to find a valid state - return VectorComposite(); // return empty state + { + WOLF_ERROR("Processor has no state. Returning an empty VectorComposite with no blocks"); + return VectorComposite(); // return empty state + } else // We found a CaptureMotion whose buffer contains the time stamp @@ -717,7 +723,6 @@ CaptureMotionPtr ProcessorMotion::findCaptureContainingTimeStamp(const TimeStamp { // Rule 1 satisfied! We found a Capture belonging to this processor's Sensor ==> it is a CaptureMotion capture_motion = std::static_pointer_cast<CaptureMotion>(capture); -// if (_ts < frame->getTimeStamp() and !capture_motion->getBuffer().empty() and _ts >= capture_motion->getBuffer().front().ts_) if (capture_motion->containsTimeStamp(_ts, params_->time_tolerance)) { @@ -808,6 +813,12 @@ bool ProcessorMotion::storeCapture(CaptureBasePtr _cap_ptr) TimeStamp ProcessorMotion::getTimeStamp ( ) const { + if (not last_ptr_) + { + WOLF_ERROR("Processor has no time stamp. Returning a non-valid timestamp equal to 0"); + return TimeStamp(0); + } + if (getBuffer().empty()) return last_ptr_->getTimeStamp();