From bb27dd6d68a24067dbd1e9eb98fc2b3010adcb65 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Thu, 26 Aug 2021 22:11:24 +0200 Subject: [PATCH] Fixed nullptr crash --- src/widgets/label.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/label.cpp b/src/widgets/label.cpp index 519e772..d0c11a2 100644 --- a/src/widgets/label.cpp +++ b/src/widgets/label.cpp @@ -28,7 +28,7 @@ void Label::redraw(std::string_view str, bool forceRedraw) !forceRedraw) return; - const auto renderedWidth = tft.drawString(str.data(), m_x, m_y); + const auto renderedWidth = str.empty() ? 0 : tft.drawString(str.data(), m_x, m_y); const auto renderedHeight = tft.fontHeight(); if (renderedWidth < m_lastWidth)