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

Closes #20027
This commit is contained in:
Regigicas authored and Aokromes committed 2017-07-15 16:32:02 +02:00
1 parent 61b0fbb9c9
commit b583c1ffec
1 file changed
+3 -2
+3 -2
View File
@@ -542,9 +542,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()))