mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user