fix(Core/Group): Fix use of a deleted pointer in the group invites list. (#21422)

This commit is contained in:
Anton Popovichenko 2025-02-12 22:24:56 +01:00 committed by GitHub
parent c92d50d6ec
commit 3baa00ae06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -667,9 +667,10 @@ void WorldSession::LogoutPlayer(bool save)
// there are some positive auras from boss encounters that can be kept by logging out and logging in after boss is dead, and may be used on next bosses
_player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP);
///- If the player is in a group and LeaveGroupOnLogout is enabled or if the player is invited to a group, remove him. If the group is then only 1 person, disband the group.
if (!_player->GetGroup() || sWorld->getBoolConfig(CONFIG_LEAVE_GROUP_ON_LOGOUT))
_player->UninviteFromGroup();
if (Group *group = _player->GetGroupInvite())
sWorld->getBoolConfig(CONFIG_LEAVE_GROUP_ON_LOGOUT)
? _player->UninviteFromGroup() // Can disband group.
: group->RemoveInvite(_player); // Just removes invite.
// remove player from the group if he is:
// a) in group; b) not in raid group; c) logging out normally (not being kicked or disconnected) d) LeaveGroupOnLogout is enabled