From 3e6424151af45eb3238dbd510cc69d534a3a7ac0 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sun, 20 Feb 2022 10:19:56 +0100 Subject: [PATCH] fix(Scripts/Scholomance): Darkmaster Gandling crash (#10546) * fix(Scripts/Scholomance): Darkmaster Gandling crash * Update boss_darkmaster_gandling.cpp * Update boss_darkmaster_gandling.cpp * Update boss_darkmaster_gandling.cpp Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com> Co-authored-by: UltraNix <80540499+UltraNix@users.noreply.github.com> --- .../Scholomance/boss_darkmaster_gandling.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 542cf2e0d..043fbf7b5 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -296,15 +296,17 @@ public: void SpellHitTarget(Unit* target, SpellInfo const* spellinfo) override { uint32 room = 0; - if (spellinfo && spellinfo->Id == SPELL_SHADOW_PORTAL && target && me->GetVictim()) + if (spellinfo && spellinfo->Id == SPELL_SHADOW_PORTAL && target) { room = GetData(GANDLING_ROOM_TO_USE); SetGate(room, CLOSED); SpawnMobsInRoom(room); DoCast(target, GandlingPortalSpells[room], true); // needs triggered somehow. - if (target->GetGUID() == me->GetVictim()->GetGUID()) + + auto victim = me->GetVictim(); + if (victim && (target->GetGUID() == victim->GetGUID())) { - me->AddThreat(me->GetVictim(), -1000000); // drop current player, add a ton to second. This should guarantee that we don't end up with both 1 and 2 in a cage... + me->AddThreat(victim, -1000000); // drop current player, add a ton to second. This should guarantee that we don't end up with both 1 and 2 in a cage... if (Unit* newTarget = SelectTarget(SelectTargetMethod::MaxThreat, 1, 200.0f)) // search in whole room { me->AddThreat(newTarget, 1000000);