[Bug Fix] Fix crash when checking Bot Group/Raid membership (#3641)

* [Bug Fix] Fix crash when checking Bot Group/Raid membership

* Update bot.cpp

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Aeadoin 2023-10-20 18:45:41 -04:00 committed by GitHub
parent 9959070f24
commit 0667fe435f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3336,7 +3336,8 @@ bool Bot::Spawn(Client* botCharacterOwner) {
if (auto raid = entity_list.GetRaidByBotName(GetName())) {
// Safety Check to confirm we have a valid raid
if (!raid->IsRaidMember(GetBotOwner()->GetName())) {
auto owner = GetBotOwner();
if (owner && !raid->IsRaidMember(owner->GetCleanName())) {
Bot::RemoveBotFromRaid(this);
} else {
SetRaidGrouped(true);
@ -3346,7 +3347,8 @@ bool Bot::Spawn(Client* botCharacterOwner) {
}
else if (auto group = entity_list.GetGroupByMobName(GetName())) {
// Safety Check to confirm we have a valid group
if (!group->IsGroupMember(GetBotOwner()->GetName())) {
auto owner = GetBotOwner();
if (owner && !group->IsGroupMember(owner->GetCleanName())) {
Bot::RemoveBotFromGroup(this, group);
} else {
SetGrouped(true);