From 8f92fbade39b4f8699b164c739f85db09a5d76e8 Mon Sep 17 00:00:00 2001 From: EricksOliveira Date: Wed, 26 Mar 2025 09:48:36 -0300 Subject: [PATCH] BG crash fix: Fixed a crash when the bot was marked as being inside a battleground but had no battleground. (#1122) --- src/strategy/values/PvpValues.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/strategy/values/PvpValues.cpp b/src/strategy/values/PvpValues.cpp index 84c586c6..a72b804a 100644 --- a/src/strategy/values/PvpValues.cpp +++ b/src/strategy/values/PvpValues.cpp @@ -21,6 +21,9 @@ Unit* FlagCarrierValue::Calculate() { BattlegroundWS* bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground(); + if (!bg) + return nullptr; + if ((!sameTeam && bot->GetTeamId() == TEAM_HORDE || (sameTeam && bot->GetTeamId() == TEAM_ALLIANCE)) && !bg->GetFlagPickerGUID(TEAM_HORDE).IsEmpty()) carrier = ObjectAccessor::GetPlayer(bg->GetBgMap(), bg->GetFlagPickerGUID(TEAM_HORDE));