Skip to content

Commit 74006ee

Browse files
authored
Merge pull request #75739 from inogenous/crash-negative-array-idx-searching-zones
Prevent crash from -1 array idx when searching zones
2 parents d58164b + e3b30b6 commit 74006ee

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ui.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,13 @@ void uilist_impl::draw_controls()
134134

135135
if( parent.desc_enabled ) {
136136
ImGui::Separator();
137-
cataimgui::draw_colored_text( parent.footer_text.empty() ?
138-
parent.entries[parent.selected].desc.c_str()
139-
: parent.footer_text.c_str() );
137+
std::string description;
138+
if( !parent.footer_text.empty() ) {
139+
description = parent.footer_text;
140+
} else if( parent.selected >= -1 ) {
141+
description = parent.entries[parent.selected].desc;
142+
}
143+
cataimgui::draw_colored_text( description );
140144
}
141145
}
142146

0 commit comments

Comments
 (0)