mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 22:43:54 +00:00
gui2/unit_create: Fix segfault on empty list when updating unit preview
This happens when the list comes up empty because of a non-matching filter, e.g. "Elvish Archer222" and the user clicks on one of the gender options in this state. Ideally we should clear the preview pane and disable the options and OK button here, but the former appears impossible and for some reason changing the pane's visibility in filter_text_changed() doesn't work reliably. (cherry-picked from commit 26629d4a621b74e90513842db577d5bd03a415de)
This commit is contained in:
parent
2b6b1ed4fe
commit
7fe7047ba9
@ -62,6 +62,9 @@
|
||||
* Fix some minor problems in macOS package
|
||||
* Fast Micro AI: Fix bug crashing the AI when units with chance-to-hit
|
||||
specials without id are on map
|
||||
* Fixed the debug mode Create Unit dialog crashing when changing the gender
|
||||
of the previous selection after causing the list to come up empty using
|
||||
the filter box.
|
||||
|
||||
## Version 1.14.4
|
||||
### Security Fixes
|
||||
|
@ -181,6 +181,10 @@ void unit_create::update_displayed_type() const
|
||||
const int selected_row
|
||||
= find_widget<listbox>(w, "unit_type_list", false).get_selected_row();
|
||||
|
||||
if(selected_row == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
find_widget<unit_preview_pane>(w, "unit_details", false)
|
||||
.set_displayed_type(units_[selected_row]->get_gender_unit_type(gender_));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user