Fixed missing checks for empty vertex arrays when updating the vertex buffers in sf::Text. (Fixes #1558)

This commit is contained in:
binary1248 2019-02-20 20:09:33 +01:00
parent 6d8143088e
commit 4043f71156
No known key found for this signature in database
GPG Key ID: E5E52A5D6082224A

View File

@ -212,7 +212,8 @@ void Text::setFillColor(const Color& color)
if (m_verticesBuffer.getVertexCount() != m_vertices.getVertexCount()) if (m_verticesBuffer.getVertexCount() != m_vertices.getVertexCount())
m_verticesBuffer.create(m_vertices.getVertexCount()); m_verticesBuffer.create(m_vertices.getVertexCount());
m_verticesBuffer.update(&m_vertices[0]); if (m_vertices.getVertexCount() > 0)
m_verticesBuffer.update(&m_vertices[0]);
} }
} }
} }
@ -238,7 +239,8 @@ void Text::setOutlineColor(const Color& color)
if (m_outlineVerticesBuffer.getVertexCount() != m_outlineVertices.getVertexCount()) if (m_outlineVerticesBuffer.getVertexCount() != m_outlineVertices.getVertexCount())
m_outlineVerticesBuffer.create(m_outlineVertices.getVertexCount()); m_outlineVerticesBuffer.create(m_outlineVertices.getVertexCount());
m_outlineVerticesBuffer.update(&m_outlineVertices[0]); if (m_outlineVertices.getVertexCount() > 0)
m_outlineVerticesBuffer.update(&m_outlineVertices[0]);
} }
} }
} }
@ -617,12 +619,14 @@ void Text::ensureGeometryUpdate() const
if (m_verticesBuffer.getVertexCount() != m_vertices.getVertexCount()) if (m_verticesBuffer.getVertexCount() != m_vertices.getVertexCount())
m_verticesBuffer.create(m_vertices.getVertexCount()); m_verticesBuffer.create(m_vertices.getVertexCount());
m_verticesBuffer.update(&m_vertices[0]); if (m_vertices.getVertexCount() > 0)
m_verticesBuffer.update(&m_vertices[0]);
if (m_outlineVerticesBuffer.getVertexCount() != m_outlineVertices.getVertexCount()) if (m_outlineVerticesBuffer.getVertexCount() != m_outlineVertices.getVertexCount())
m_outlineVerticesBuffer.create(m_outlineVertices.getVertexCount()); m_outlineVerticesBuffer.create(m_outlineVertices.getVertexCount());
m_outlineVerticesBuffer.update(&m_outlineVertices[0]); if (m_outlineVertices.getVertexCount() > 0)
m_outlineVerticesBuffer.update(&m_outlineVertices[0]);
} }
} }