From 4c4cfeff126cd96869d6bcfa61f52cb479bfdb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Mon, 16 Dec 2024 01:33:48 +0100 Subject: [PATCH] Negative currentSize means we don't render the widget yet, return a default value. --- .../ui/widgets/general/display/dynamic_font_size_label.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cockatrice/src/client/ui/widgets/general/display/dynamic_font_size_label.cpp b/cockatrice/src/client/ui/widgets/general/display/dynamic_font_size_label.cpp index 4414cb605..2a48de86e 100644 --- a/cockatrice/src/client/ui/widgets/general/display/dynamic_font_size_label.cpp +++ b/cockatrice/src/client/ui/widgets/general/display/dynamic_font_size_label.cpp @@ -57,6 +57,10 @@ float DynamicFontSizeLabel::getWidgetMaximumFontSize(QWidget *widget, QString te return currentSize; } + if (currentSize < 0) { + return 1; + } + /* Only stop when step is small enough and new size is smaller than QWidget */ while(step>FONT_PRECISION || (currentHeight > widgetHeight) || (currentWidth > widgetWidth)){ /* Keep last tested value */