Skip to content

Commit

Permalink
fix assertion error in case that the scenario has no [side]s
Browse files Browse the repository at this point in the history
fixes #2818
  • Loading branch information
gfgtdf committed Mar 16, 2020
1 parent 0cdb3e5 commit fe79921
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/play_controller.cpp
Expand Up @@ -36,6 +36,7 @@
#include "hotkey/hotkey_item.hpp"
#include "hotkey/hotkey_handler.hpp"
#include "map/label.hpp"
#include "game_errors.hpp"
#include "gettext.hpp"
#include "gui/dialogs/loading_screen.hpp"
#include "gui/dialogs/transient_message.hpp"
Expand Down Expand Up @@ -712,12 +713,18 @@ void play_controller::tab()

team& play_controller::current_team()
{
if(gamestate().board_.teams().size() == 0) {
throw game::game_error("The scenario has no sides defined");
}
assert(gamestate().board_.has_team(current_side()));
return gamestate().board_.get_team(current_side());
}

const team& play_controller::current_team() const
{
if(gamestate().board_.teams().size() == 0) {
throw game::game_error("The scenario has no sides defined");
}
assert(gamestate().board_.has_team(current_side()));
return gamestate().board_.get_team(current_side());
}
Expand Down

0 comments on commit fe79921

Please sign in to comment.