Fix crash after hitting enter when no units match the recruit list filter
This is essentially the same as https://github.com/wesnoth/wesnoth/pull/3476, except that it is applied to the recruit dialog rather than the recall dialog.
This commit is contained in:
parent
0379e2e832
commit
7f71d81478
1 changed files with 6 additions and 1 deletions
|
@ -277,7 +277,12 @@ void menu_handler::recruit(int side_num, const map_location& last_hex)
|
|||
|
||||
if(dlg.show()) {
|
||||
map_location recruit_hex = last_hex;
|
||||
do_recruit(sample_units[dlg.get_selected_index()]->id(), side_num, recruit_hex);
|
||||
int index = dlg.get_selected_index();
|
||||
if (index < 0) {
|
||||
gui2::show_transient_message("", _("No unit recruited"));
|
||||
return;
|
||||
}
|
||||
do_recruit(sample_units[index]->id(), side_num, recruit_hex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue