diff --git a/src/PlayerbotMgr.cpp b/src/PlayerbotMgr.cpp index 7d6251b0..055a3bce 100644 --- a/src/PlayerbotMgr.cpp +++ b/src/PlayerbotMgr.cpp @@ -1027,6 +1027,12 @@ void PlayerbotsMgr::AddPlayerbotData(Player* player, bool isBotAI) { return; } + // If the guid already exists in the map, remove it + std::unordered_map::iterator itr = _playerbotsMap.find(player->GetGUID()); + if (itr != _playerbotsMap.end()) + { + _playerbotsMap.erase(itr); + } if (!isBotAI) { PlayerbotMgr* playerbotMgr = new PlayerbotMgr(player);