diff --git a/src/SFML/Graphics/ConvexShape.cpp b/src/SFML/Graphics/ConvexShape.cpp index 978862e2..da446ddc 100644 --- a/src/SFML/Graphics/ConvexShape.cpp +++ b/src/SFML/Graphics/ConvexShape.cpp @@ -27,6 +27,8 @@ //////////////////////////////////////////////////////////// #include +#include + namespace sf { @@ -55,6 +57,7 @@ std::size_t ConvexShape::getPointCount() const //////////////////////////////////////////////////////////// void ConvexShape::setPoint(std::size_t index, const Vector2f& point) { + assert(index < m_points.size() && "Index is out of bounds"); m_points[index] = point; update(); } @@ -63,6 +66,7 @@ void ConvexShape::setPoint(std::size_t index, const Vector2f& point) //////////////////////////////////////////////////////////// Vector2f ConvexShape::getPoint(std::size_t index) const { + assert(index < m_points.size() && "Index is out of bounds"); return m_points[index]; } diff --git a/src/SFML/Graphics/VertexArray.cpp b/src/SFML/Graphics/VertexArray.cpp index 9067ec7a..027f2bee 100644 --- a/src/SFML/Graphics/VertexArray.cpp +++ b/src/SFML/Graphics/VertexArray.cpp @@ -28,6 +28,8 @@ #include #include +#include + namespace sf { @@ -51,6 +53,7 @@ std::size_t VertexArray::getVertexCount() const //////////////////////////////////////////////////////////// Vertex& VertexArray::operator[](std::size_t index) { + assert(index < m_vertices.size() && "Index is out of bounds"); return m_vertices[index]; } @@ -58,6 +61,7 @@ Vertex& VertexArray::operator[](std::size_t index) //////////////////////////////////////////////////////////// const Vertex& VertexArray::operator[](std::size_t index) const { + assert(index < m_vertices.size() && "Index is out of bounds"); return m_vertices[index]; } diff --git a/src/SFML/System/String.cpp b/src/SFML/System/String.cpp index cf2d95ae..7de8eea6 100644 --- a/src/SFML/System/String.cpp +++ b/src/SFML/System/String.cpp @@ -31,6 +31,7 @@ #include #include +#include #include @@ -213,6 +214,7 @@ String& String::operator+=(const String& right) //////////////////////////////////////////////////////////// char32_t String::operator[](std::size_t index) const { + assert(index < m_string.size() && "Index is out of bounds"); return m_string[index]; } @@ -220,6 +222,7 @@ char32_t String::operator[](std::size_t index) const //////////////////////////////////////////////////////////// char32_t& String::operator[](std::size_t index) { + assert(index < m_string.size() && "Index is out of bounds"); return m_string[index]; }