From ea338c43aae91999df3a03303147bf317ab9743f Mon Sep 17 00:00:00 2001 From: Sara Date: Sat, 16 Mar 2024 22:12:52 +0100 Subject: [PATCH] fix(error checking): initialize_player will only continue if the given player id is valid --- game_root.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/game_root.cpp b/game_root.cpp index e082933..293cbfc 100644 --- a/game_root.cpp +++ b/game_root.cpp @@ -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 &found{this->players.get(id)}; this->add_child(player->to_node()); player->player_id = id;