diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index 16524f5e..b979635f 100644 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp @@ -240,8 +240,8 @@ void Shape::updateTexCoords() { for (unsigned int i = 0; i < m_vertices.getVertexCount(); ++i) { - float xratio = (m_vertices[i].position.x - m_insideBounds.left) / m_insideBounds.width; - float yratio = (m_vertices[i].position.y - m_insideBounds.top) / m_insideBounds.height; + float xratio = m_insideBounds.width > 0 ? (m_vertices[i].position.x - m_insideBounds.left) / m_insideBounds.width : 0; + float yratio = m_insideBounds.height > 0 ? (m_vertices[i].position.y - m_insideBounds.top) / m_insideBounds.height : 0; m_vertices[i].texCoords.x = m_textureRect.left + m_textureRect.width * xratio; m_vertices[i].texCoords.y = m_textureRect.top + m_textureRect.height * yratio; }