Skip to content

Commit

Permalink
Fixed missing checks for empty vertex arrays when updating the vertex…
Browse files Browse the repository at this point in the history
… buffers in sf::Text. (Fixes SFML#1558)
  • Loading branch information
binary1248 committed Feb 20, 2019
1 parent 6d81430 commit 4043f71
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/SFML/Graphics/Text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ void Text::setFillColor(const Color& color)
if (m_verticesBuffer.getVertexCount() != 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]);
}
}
}
Expand All @@ -238,7 +239,8 @@ void Text::setOutlineColor(const Color& color)
if (m_outlineVerticesBuffer.getVertexCount() != 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]);
}
}
}
Expand Down Expand Up @@ -617,12 +619,14 @@ void Text::ensureGeometryUpdate() const
if (m_verticesBuffer.getVertexCount() != 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())
m_outlineVerticesBuffer.create(m_outlineVertices.getVertexCount());

m_outlineVerticesBuffer.update(&m_outlineVertices[0]);
if (m_outlineVertices.getVertexCount() > 0)
m_outlineVerticesBuffer.update(&m_outlineVertices[0]);
}
}

Expand Down

0 comments on commit 4043f71

Please sign in to comment.