From 74cbb0fdf43775e3216bfe401ead551e8cf9d167 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 22 Aug 2020 14:54:58 -0400 Subject: [PATCH] Scripts/Commands: Fix a crash on summon when no group is avaible Port From (https://github.com/TrinityCore/TrinityCore/commit/e43d81cd687a0c18ebec3f320f53a780d950843d) --- Source/Game/Chat/Commands/MiscCommands.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index e47e5a06e..de97e5afa 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -678,17 +678,22 @@ namespace Game.Chat } else if (map.Instanceable()) { - Group targetGroup = target.GetGroup(); Map targetMap = target.GetMap(); - Player targetGroupLeader = Global.ObjAccessor.GetPlayer(map, targetGroup.GetLeaderGUID()); + + Player targetGroupLeader = null; + Group targetGroup = target.GetGroup(); + if (targetGroup != null) + targetGroupLeader = Global.ObjAccessor.GetPlayer(map, targetGroup.GetLeaderGUID()); // check if far teleport is allowed - if (!targetGroupLeader || (targetGroupLeader.GetMapId() != map.GetId()) || (targetGroupLeader.GetInstanceId() != map.GetInstanceId())) + if (targetGroupLeader == null || (targetGroupLeader.GetMapId() != map.GetId()) || (targetGroupLeader.GetInstanceId() != map.GetInstanceId())) + { if ((targetMap.GetId() != map.GetId()) || (targetMap.GetInstanceId() != map.GetInstanceId())) { handler.SendSysMessage(CypherStrings.CannotSummonToInst); return false; } + } // check if we're already in a different instance of the same map if ((targetMap.GetId() == map.GetId()) && (targetMap.GetInstanceId() != map.GetInstanceId()))