BG crash fix: Fixed a crash when the bot was marked as being inside a battleground but had no battleground. (#1122)

This commit is contained in:
EricksOliveira
2025-03-26 09:48:36 -03:00
committed by GitHub
parent d9da6d942d
commit 8f92fbade3

View File

@@ -21,6 +21,9 @@ Unit* FlagCarrierValue::Calculate()
{ {
BattlegroundWS* bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground(); BattlegroundWS* bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground();
if (!bg)
return nullptr;
if ((!sameTeam && bot->GetTeamId() == TEAM_HORDE || (sameTeam && bot->GetTeamId() == TEAM_ALLIANCE)) && if ((!sameTeam && bot->GetTeamId() == TEAM_HORDE || (sameTeam && bot->GetTeamId() == TEAM_ALLIANCE)) &&
!bg->GetFlagPickerGUID(TEAM_HORDE).IsEmpty()) !bg->GetFlagPickerGUID(TEAM_HORDE).IsEmpty())
carrier = ObjectAccessor::GetPlayer(bg->GetBgMap(), bg->GetFlagPickerGUID(TEAM_HORDE)); carrier = ObjectAccessor::GetPlayer(bg->GetBgMap(), bg->GetFlagPickerGUID(TEAM_HORDE));