From bdc515e424e369820831f14607377d67d135d9e0 Mon Sep 17 00:00:00 2001 From: attila Date: Fri, 28 Mar 2025 21:37:34 +0100 Subject: [PATCH] ShapedText: Fix crash caused by failing to find a fallback font for all codepoints --- .../juce_graphics/detail/juce_SimpleShapedText.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/modules/juce_graphics/detail/juce_SimpleShapedText.cpp b/modules/juce_graphics/detail/juce_SimpleShapedText.cpp index df56f0c1b8..68f3233181 100644 --- a/modules/juce_graphics/detail/juce_SimpleShapedText.cpp +++ b/modules/juce_graphics/detail/juce_SimpleShapedText.cpp @@ -989,16 +989,15 @@ struct Shaper } auto glyphsIt = shapedGlyphs.find (startFrom); - - // The stored glyphs data can be empty if there are input codepoints for which we failed to - // resolve a valid Typeface::Ptr. - if (glyphsIt == shapedGlyphs.end() || glyphsIt->value.data->empty()) - return {}; - WrappedGlyphs result; while (true) { + // The stored glyphs data can be empty if there are input codepoints for which we failed to + // resolve a valid Typeface::Ptr. + if (glyphsIt == shapedGlyphs.end() || glyphsIt->value.data->empty()) + break; + const ShapedGlyph* start = glyphsIt->value.data->data(); const ShapedGlyph* const endIt = glyphsIt->value.data->data() + glyphsIt->value.data->size(); @@ -1024,9 +1023,6 @@ struct Shaper break; ++glyphsIt; - - if (glyphsIt == shapedGlyphs.end()) - break; } return result;