From 8ac7d5823068e25b411263b5a9697c0f8b00f080 Mon Sep 17 00:00:00 2001 From: EricksOliveira Date: Sat, 19 Oct 2024 14:29:44 -0300 Subject: [PATCH] Fix Crash The Nexux Log Crash: 00007FF7750C05ED 00000028A47FEA10 FirebombSpreadAction::Execute+1AD E:\Server\Heroes_Azeroth\modules\mod-playerbots\src\strategy\dungeons\wotlk\nexus\NexusActions.cpp line 58 This PR fixes a possible crash in the FirebombSpreadAction::Execute function, located in the NexusActions.cpp file, which occurred due to the lack of checking for null pointers when accessing group members. Main changes: Added a null pointer check to ensure botAI->GetUnit(member) returns a valid unit before calling functions like GetExactDist2d and MoveAway. If botAI->GetUnit(member) returns nullptr, execution ignores the specific member, avoiding access to an invalid pointer that could cause a server crash. --- src/strategy/dungeons/wotlk/nexus/NexusActions.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/strategy/dungeons/wotlk/nexus/NexusActions.cpp b/src/strategy/dungeons/wotlk/nexus/NexusActions.cpp index 1a918614..e494251e 100644 --- a/src/strategy/dungeons/wotlk/nexus/NexusActions.cpp +++ b/src/strategy/dungeons/wotlk/nexus/NexusActions.cpp @@ -54,9 +54,16 @@ bool FirebombSpreadAction::Execute(Event event) { continue; } - if (bot->GetExactDist2d(botAI->GetUnit(member)) < targetDist) + + Unit* unit = botAI->GetUnit(member); + if (!unit) { - return MoveAway(botAI->GetUnit(member), targetDist); + continue; + } + + if (bot->GetExactDist2d(unit) < targetDist) + { + return MoveAway(unit, targetDist); } } return false;