mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[11920] Fix possible crash when trying to add playerto group who is not in world
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
6c8000705f
commit
b984d3f787
5 changed files with 25 additions and 18 deletions
|
|
@ -73,21 +73,19 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
|
|||
return ret;
|
||||
}
|
||||
|
||||
Player*
|
||||
ObjectAccessor::FindPlayer(ObjectGuid guid)
|
||||
Player* ObjectAccessor::FindPlayer(ObjectGuid guid, bool inWorld /*= true*/)
|
||||
{
|
||||
if (!guid)
|
||||
return NULL;
|
||||
|
||||
Player * plr = HashMapHolder<Player>::Find(guid);;
|
||||
if (!plr || !plr->IsInWorld())
|
||||
Player* plr = HashMapHolder<Player>::Find(guid);;
|
||||
if (!plr || (!plr->IsInWorld() && inWorld))
|
||||
return NULL;
|
||||
|
||||
return plr;
|
||||
}
|
||||
|
||||
Player*
|
||||
ObjectAccessor::FindPlayerByName(const char *name)
|
||||
Player* ObjectAccessor::FindPlayerByName(const char *name)
|
||||
{
|
||||
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue