From 2000c061671b7ae0024bc7a8ff1cc2974c14db05 Mon Sep 17 00:00:00 2001 From: Jelly Date: Sat, 21 Jun 2025 23:55:35 -0500 Subject: [PATCH] Fix various hunter bugs (Amended w/ Nullptr check) (#1389) * Fixes #1093 (Hunter's stuck in Autoshoot and Can't equip gear) * Fixes #1093 (Hunter's stuck in Autoshoot and Can't equip gear) --- src/strategy/actions/ChooseTargetActions.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/strategy/actions/ChooseTargetActions.cpp b/src/strategy/actions/ChooseTargetActions.cpp index 77dc08fb..e5bfc7c6 100644 --- a/src/strategy/actions/ChooseTargetActions.cpp +++ b/src/strategy/actions/ChooseTargetActions.cpp @@ -83,12 +83,14 @@ bool DropTargetAction::Execute(Event event) bot->SetTarget(ObjectGuid::Empty); bot->SetSelection(ObjectGuid()); botAI->ChangeEngine(BOT_STATE_NON_COMBAT); - if (bot->getClass() == CLASS_HUNTER && - (bot->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo->Id == 75)) - //Is bot a hunter and is Auto Shot Active? + if (bot->getClass() == CLASS_HUNTER) // Check for Hunter Class + { + Spell const* spell = bot->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL); // Get the current spell being cast by the bot + if (spell && spell->m_spellInfo->Id == 75) //Check spell is not nullptr before accessing m_spellInfo { bot->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); // Interrupt Auto Shot } + } bot->AttackStop(); // if (Pet* pet = bot->GetPet())