Fix a crash when printing an empty string.

This commit is contained in:
Sasha Szpakowski
2023-02-11 15:55:49 -04:00
parent c24f95d72e
commit ee96b6fa68
+4 -1
View File
@@ -118,6 +118,9 @@ void HarfbuzzShaper::computeBufferRanges(const ColoredCodepoints &codepoints, Ra
{
bufferranges.clear();
if (codepoints.cps.size() == 0)
return;
// Less computation for the typical case (no fallback fonts).
if (rasterizers.size() == 1)
{
@@ -195,7 +198,7 @@ void HarfbuzzShaper::computeBufferRanges(const ColoredCodepoints &codepoints, Ra
void HarfbuzzShaper::computeGlyphPositions(const ColoredCodepoints &codepoints, Range range, Vector2 offset, float extraspacing, std::vector<GlyphPosition> *positions, std::vector<IndexedColor> *colors, TextInfo *info)
{
if (!range.isValid())
if (!range.isValid() && !codepoints.cps.empty())
range = Range(0, codepoints.cps.size());
offset.y += getBaseline();