mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-21 11:29:38 +00:00
fix uninit team_num_ in events::mouse_handler
change wassert to replay::throw_error for invalid message option
This commit is contained in:
parent
cafaea8335
commit
12af90d981
@ -1503,7 +1503,13 @@ bool event_handler::handle_event_command(const queued_event& event_info,
|
||||
|
||||
//implement the consequences of the choice
|
||||
if(options.empty() == false) {
|
||||
wassert(size_t(option_chosen) < menu_items.size());
|
||||
if(size_t(option_chosen) >= menu_items.size()) {
|
||||
std::stringstream errbuf;
|
||||
errbuf << "invalid choice (" << option_chosen
|
||||
<< ") was specified, choice 0 to " << (menu_items.size() - 1)
|
||||
<< " was expected.\n";
|
||||
replay::throw_error(errbuf.str());
|
||||
}
|
||||
|
||||
vconfig::child_list events = option_events[option_chosen];
|
||||
for(vconfig::child_list::const_iterator itor = events.begin();
|
||||
|
@ -678,6 +678,7 @@ undo_stack_(undo_stack), redo_stack_(redo_stack)
|
||||
undo_ = false;
|
||||
show_menu_ = false;
|
||||
over_route_ = false;
|
||||
team_num_ = 1;
|
||||
}
|
||||
|
||||
void mouse_handler::set_team(const int team_number)
|
||||
|
Loading…
x
Reference in New Issue
Block a user