diff --git a/grid_map_core/src/iterators/SpiralIterator.cpp b/grid_map_core/src/iterators/SpiralIterator.cpp index 6e094eb9a..168fb8564 100644 --- a/grid_map_core/src/iterators/SpiralIterator.cpp +++ b/grid_map_core/src/iterators/SpiralIterator.cpp @@ -66,6 +66,9 @@ const Eigen::Array2i & SpiralIterator::operator*() const SpiralIterator & SpiralIterator::operator++() { + if (isPastEnd()) { + return *this; + } pointsRing_.pop_back(); if (pointsRing_.empty() && !isPastEnd()) {generateRing();} return *this;