Fix crash when bot re-logs

This commit is contained in:
郑佩茹
2022-03-25 16:36:23 -06:00
parent 9797dd0371
commit 41bcfbfcb6

View File

@@ -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<ObjectGuid, PlayerbotAIBase*>::iterator itr = _playerbotsMap.find(player->GetGUID());
if (itr != _playerbotsMap.end())
{
_playerbotsMap.erase(itr);
}
if (!isBotAI)
{
PlayerbotMgr* playerbotMgr = new PlayerbotMgr(player);