[Crash] Add additional raid integrity checks on Bot Spawn. (#3295)

* simple cleanup before changes

* can't be in a raid yet

* change to sizeof

* change to use sizeof
This commit is contained in:
Aeadoin
2023-04-16 10:06:19 -04:00
committed by GitHub
parent d45a57056a
commit 93db35658a
3 changed files with 22 additions and 25 deletions
+8 -9
View File
@@ -422,12 +422,6 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
}
cur_end = max_end;
// Safety Check to confirm we have a valid raid
if (HasRaid() && !GetRaid()->IsRaidMember(GetBotOwner()->CastToClient())) {
Bot::RemoveBotFromRaid(this);
}
}
Bot::~Bot() {
@@ -3307,11 +3301,16 @@ bool Bot::Spawn(Client* botCharacterOwner) {
}
if (auto raid = entity_list.GetRaidByBotName(GetName())) {
raid->VerifyRaid();
SetRaidGrouped(true);
// Safety Check to confirm we have a valid raid
if (raid->IsRaidMember(GetBotOwner()->CastToClient())) {
Bot::RemoveBotFromRaid(this);
} else {
raid->LearnMembers();
SetRaidGrouped(true);
}
}
else if (auto group = entity_list.GetGroupByMobName(GetName())) {
group->VerifyGroup();
group->LearnMembers();
SetGrouped(true);
}