diff --git a/Polygon/include/CGAL/Polygon_2.h b/Polygon/include/CGAL/Polygon_2.h index 7623916b0a5..20770ad9062 100644 --- a/Polygon/include/CGAL/Polygon_2.h +++ b/Polygon/include/CGAL/Polygon_2.h @@ -423,7 +423,10 @@ class Polygon_2 { /// Returns a (const) reference to the `i`-th vertex. const Point_2& vertex(std::size_t i) const - { return *(d_container.begin() + i); } + { + CGAL_precondition( i < d_container.size() ); + return *(d_container.begin() + i); + } /// Returns a (const) reference to the `i`-th vertex.