From 42dd6d16d775bf58481b46f3be988c27c6107225 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 18 Dec 2024 16:21:11 +0100 Subject: [PATCH] fix reading char from empty line --- src/chat_gui4.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index edab608..9b69c84 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -1044,7 +1044,7 @@ void ChatGui4::renderMessageBodyText(Message3Registry& reg, const Message3 e) { ImGui::BeginGroup(); do { const auto current_line = msgtext_sv.substr(pos_prev, pos_next - pos_prev); - if (current_line.front() == '>') { + if (!current_line.empty() && current_line.front() == '>') { // TODO: theming ImGui::PushStyleColor(ImGuiCol_Text, {0.3f, 0.9f, 0.1f, 1.f}); ImGui::TextUnformatted(current_line.data(), current_line.data()+current_line.size());