diff --git a/src/cata_imgui.cpp b/src/cata_imgui.cpp index 120551e6b2a91..578c9709730bb 100644 --- a/src/cata_imgui.cpp +++ b/src/cata_imgui.cpp @@ -433,14 +433,15 @@ void cataimgui::draw_colored_text( std::string const &text, nc_color &color, void cataimgui::draw_colored_text( std::string const &text, float wrap_width, bool *is_selected, bool *is_focused, bool *is_hovered ) { + if( text.empty() ) { + ImGui::NewLine(); + return; + } + ImGui::PushID( text.c_str() ); int startColorStackCount = GImGui->ColorStack.Size; ImGuiID itemId = GImGui->CurrentWindow->IDStack.back(); - if( text.empty() ) { - ImGui::NewLine( ); - } - size_t chars_per_line = size_t( wrap_width ); if( chars_per_line == 0 ) { chars_per_line = SIZE_MAX;