Skip to content

Commit c1b1dc7

Browse files
Fixed TextLayout::getStringBounds nullptr error for empty strings
1 parent 5179f4e commit c1b1dc7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/juce_graphics/fonts/juce_TextLayout.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ class JUCE_API TextLayout final
275275
{
276276
TextLayout layout;
277277
layout.createLayout (string, std::numeric_limits<float>::max());
278+
279+
if (layout.getNumLines() == 0)
280+
{
281+
return Rectangle<float>{};
282+
}
278283
return layout.getLine (0).getLineBounds();
279284
}
280285

0 commit comments

Comments
 (0)