fix(error checking): initialize_player will only continue if the given player id is valid
parent
5b73bb53ca
commit
ea338c43aa
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue