fix(error checking): initialize_player will only continue if the given player id is valid

stripped
Sara 2024-03-16 22:12:52 +01:00
parent 5b73bb53ca
commit ea338c43aa
1 changed files with 2 additions and 0 deletions

View File

@ -57,6 +57,8 @@ void GameRoot::player_removed(uint32_t player_id) {
}
bool GameRoot::initialize_player(IPlayer *player, uint32_t id) {
if(!this->players.has(id))
return false;
Pair<PlayerInput*, IPlayer*> &found{this->players.get(id)};
this->add_child(player->to_node());
player->player_id = id;