Skip to content

Commit

Permalink
Merge pull request #75739 from inogenous/crash-negative-array-idx-sea…
Browse files Browse the repository at this point in the history
…rching-zones

Prevent crash from -1 array idx when searching zones
  • Loading branch information
Maleclypse authored Aug 18, 2024
2 parents d58164b + e3b30b6 commit 74006ee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,13 @@ void uilist_impl::draw_controls()

if( parent.desc_enabled ) {
ImGui::Separator();
cataimgui::draw_colored_text( parent.footer_text.empty() ?
parent.entries[parent.selected].desc.c_str()
: parent.footer_text.c_str() );
std::string description;
if( !parent.footer_text.empty() ) {
description = parent.footer_text;
} else if( parent.selected >= -1 ) {
description = parent.entries[parent.selected].desc;
}
cataimgui::draw_colored_text( description );
}
}

Expand Down

0 comments on commit 74006ee

Please sign in to comment.