Skip to content

Commit

Permalink
LFG: Safeguard LFGQueue::GroupUpdateUI against crash
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Sep 13, 2024
1 parent 225a371 commit 4e26029
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/game/LFG/LFGQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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();
}
}
});
}

Expand Down

0 comments on commit 4e26029

Please sign in to comment.