From c3bcf57f99fabace94fab095927dcbaab65fd2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 16 Nov 2024 13:58:12 +0100 Subject: [PATCH] Fix client hanging when rendering text with small maximum width Previously, when rendering text with a maximum width that is too small for a single glyph then the text rendering would loop indefinitely trying to advance the cursor to the next line where the glyph will also not fit. --- src/engine/client/text.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index 252f80f03..7bea8c5f8 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -1560,6 +1560,7 @@ public: const char *pCurrent = pText; const char *pEnd = pCurrent + Length; + const char *pPrevBatchEnd = nullptr; const char *pEllipsis = "…"; const SGlyph *pEllipsisGlyph = nullptr; if(pCursor->m_Flags & TEXTFLAG_ELLIPSIS_AT_END) @@ -1966,6 +1967,9 @@ public: if(NewLine) { + if(pPrevBatchEnd == pBatchEnd) + break; + pPrevBatchEnd = pBatchEnd; if(!StartNewLine()) break; GotNewLineLast = true;