Scripts/Commands: Fix a crash on summon when no group is avaible (#20029)

Closes #20027

(cherry picked from commit d9c83a6c01)
This commit is contained in:
Regigicas
2017-07-15 13:43:03 +02:00
committed by Shauren
parent af5c195e7f
commit e43d81cd68

View File

@@ -557,9 +557,10 @@ public:
}
else if (map->Instanceable())
{
Group* targetGroup = target->GetGroup();
Map* targetMap = target->GetMap();
Player* targetGroupLeader = ObjectAccessor::GetPlayer(map, targetGroup->GetLeaderGUID());
Player* targetGroupLeader = nullptr;
if (Group* targetGroup = target->GetGroup())
targetGroupLeader = ObjectAccessor::GetPlayer(map, targetGroup->GetLeaderGUID());
// check if far teleport is allowed
if (!targetGroupLeader || (targetGroupLeader->GetMapId() != map->GetId()) || (targetGroupLeader->GetInstanceId() != map->GetInstanceId()))