Fix early crash if no teams are defined

gui_->viewing_team() in refresh_objectives results in invalid index access if there are no teams here.
This commit is contained in:
Charles Dang 2024-08-31 23:57:26 -04:00
parent 93cfddaa27
commit d37679a7c9

View file

@ -363,9 +363,11 @@ void play_controller::fire_prestart()
void play_controller::refresh_objectives() const
{
const config cfg("side", gui_->viewing_team().side());
gamestate().lua_kernel_->run_wml_action("show_objectives", vconfig(cfg),
game_events::queued_event("_from_interface", "", map_location(), map_location(), config()));
if(!get_teams().empty()) {
const config cfg("side", gui_->viewing_team().side());
gamestate().lua_kernel_->run_wml_action("show_objectives", vconfig(cfg),
game_events::queued_event("_from_interface", "", map_location(), map_location(), config()));
}
}
void play_controller::fire_start()