From 571735cd576db0bfbbf621c5576c36a88d460e03 Mon Sep 17 00:00:00 2001 From: Crow Date: Sat, 30 May 2026 22:10:33 -0500 Subject: [PATCH] Fix crash from missing spellInfo check in TogglePetSpellAutoCastAction (#2431) ## Pull Request Description I had repeated crashes upon login traced to line 89 of TogglePetSpellAutoCastAction, where a spellInfo check is missing. I confirmed that adding the check fixed my crashing. I don't know why there was invalid spellInfo to create the crash, as this missing check is not a new development and I never had a crash before, but clearly this code should be fixed in any case. ## Feature Evaluation - Describe the **minimum logic** required to achieve the intended behavior. - Describe the **processing cost** when this logic executes across many bots. ## How to Test the Changes ## Impact Assessment - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [x] No - - [ ] Yes (**explain why**) - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## AI Assistance Was AI assistance used while working on this change? - - [x] No - - [ ] Yes (**explain below**) ## Final Checklist - - [x] Stability is not compromised. - - [x] Performance impact is understood, tested, and acceptable. - - [x] Added logic complexity is justified and explained. - - [x] Any new bot dialogue lines are translated. - - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers --- src/Ai/Base/Actions/GenericActions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ai/Base/Actions/GenericActions.cpp b/src/Ai/Base/Actions/GenericActions.cpp index 354cb456e..4371cb402 100644 --- a/src/Ai/Base/Actions/GenericActions.cpp +++ b/src/Ai/Base/Actions/GenericActions.cpp @@ -86,7 +86,7 @@ bool TogglePetSpellAutoCastAction::Execute(Event /*event*/) uint32 spellId = itr->first; const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!spellInfo->IsAutocastable()) + if (!spellInfo || !spellInfo->IsAutocastable()) continue; bool shouldApply = true;