From 4e26029cfd3922c6c29f8be4f7f26e57f1bcd265 Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 13 Sep 2024 22:35:11 +0200 Subject: [PATCH] LFG: Safeguard LFGQueue::GroupUpdateUI against crash --- src/game/LFG/LFGQueue.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/game/LFG/LFGQueue.cpp b/src/game/LFG/LFGQueue.cpp index 654718b9d2..e18056d969 100644 --- a/src/game/LFG/LFGQueue.cpp +++ b/src/game/LFG/LFGQueue.cpp @@ -720,18 +720,7 @@ void LFGQueue::GroupUpdateUI(ObjectGuid leaderGuid, bool completed) sWorld.GetMessager().AddMessage([leaderGuid, completed, members](World* world) { - Player* player = sObjectMgr.GetPlayer(leaderGuid); - - if (completed) - { - player->GetSession()->SendMeetingStoneComplete(); - if (sWorld.getConfig(CONFIG_BOOL_CHANNEL_RESTRICTED_LFG) && player->GetSession()->GetSecurity() == SEC_PLAYER) - player->LeaveLFGChannel(); - } - else - player->GetSession()->SendLFGUpdate(); - - for (auto& member : members) + if (Player* player = sObjectMgr.GetPlayer(leaderGuid)) { if (completed) { @@ -742,6 +731,21 @@ void LFGQueue::GroupUpdateUI(ObjectGuid leaderGuid, bool completed) else player->GetSession()->SendLFGUpdate(); } + + for (auto& memberGuid : members) + { + if (Player* member = sObjectMgr.GetPlayer(memberGuid)) + { + if (completed) + { + member->GetSession()->SendMeetingStoneComplete(); + if (sWorld.getConfig(CONFIG_BOOL_CHANNEL_RESTRICTED_LFG) && member->GetSession()->GetSecurity() == SEC_PLAYER) + member->LeaveLFGChannel(); + } + else + member->GetSession()->SendLFGUpdate(); + } + } }); }