summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Popovichenko <anton.popovichenko@mendix.com>2025-02-12 22:24:56 +0100
committerGitHub <noreply@github.com>2025-02-12 18:24:56 -0300
commit3baa00ae06da1ffd5e095376d8c72e626a98247c (patch)
treeeda2571c5f65faf0a90ac119ae76086db4ce7e07
parentc92d50d6ec26f34a994ca80dc06e42cbd0eb9364 (diff)
fix(Core/Group): Fix use of a deleted pointer in the group invites list. (#21422)
-rw-r--r--src/server/game/Server/WorldSession.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 3f8562362d..c12b773a69 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -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