From 189f3a7bbc8be81c4a5a7badee2d8de9ee7b3f8a Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Sat, 21 Feb 2026 04:40:47 -0800 Subject: [PATCH] [ChatView] Fix game log first line incorrect background color (#6612) --- .../src/interface/widgets/server/chat_view/chat_view.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/interface/widgets/server/chat_view/chat_view.cpp b/cockatrice/src/interface/widgets/server/chat_view/chat_view.cpp index adbae45c5..ffd4986a6 100644 --- a/cockatrice/src/interface/widgets/server/chat_view/chat_view.cpp +++ b/cockatrice/src/interface/widgets/server/chat_view/chat_view.cpp @@ -75,8 +75,14 @@ void ChatView::adjustColorsToPalette() void ChatView::refreshBlockColors() { QTextDocument *doc = document(); - QTextCursor cursor(doc); + // Empty QTextDocuments still have 1 block, so we need handle this edge case + if (doc->isEmpty()) { + evenNumber = true; + return; + } + + QTextCursor cursor(doc); bool even = true; // start fresh for (QTextBlock block = doc->begin(); block.isValid(); block = block.next()) {