diff --git a/modules/videoio/src/cap_mjpeg_decoder.cpp b/modules/videoio/src/cap_mjpeg_decoder.cpp index f8ba6857f3..02400fd9f0 100644 --- a/modules/videoio/src/cap_mjpeg_decoder.cpp +++ b/modules/videoio/src/cap_mjpeg_decoder.cpp @@ -146,6 +146,9 @@ bool MotionJpegCapture::grabFrame() } else { + if (m_frame_iterator == m_mjpeg_frames.end()) + return false; + ++m_frame_iterator; } }