From 62e480fed714d003ab83b398cfb9820ea4968b2d Mon Sep 17 00:00:00 2001 From: hg <4683435+hgtw@users.noreply.github.com> Date: Sat, 30 Jan 2021 18:31:19 -0500 Subject: [PATCH] Verify expedition is not empty on invites Fixes an edge case where a member could accept a pending invite into an empty expedition before world could invalidate it --- zone/expedition.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/zone/expedition.cpp b/zone/expedition.cpp index f75b09c3f..cf9ebc0c1 100644 --- a/zone/expedition.cpp +++ b/zone/expedition.cpp @@ -781,11 +781,19 @@ bool Expedition::ProcessAddConflicts(Client* leader_client, Client* add_client, } } - // swapping ignores the max player count check since it's a 1:1 change - if (!swapping && ExpeditionDatabase::GetMemberCount(m_id) >= m_max_players) + // member swapping integrity is handled by invite response + if (!swapping) { - SendLeaderMessage(leader_client, Chat::Red, DZADD_EXCEED_MAX, { fmt::format_int(m_max_players).str() }); - has_conflict = true; + auto member_count = ExpeditionDatabase::GetMemberCount(m_id); + if (member_count == 0) + { + has_conflict = true; + } + else if (member_count >= m_max_players) + { + SendLeaderMessage(leader_client, Chat::Red, DZADD_EXCEED_MAX, { fmt::format_int(m_max_players).str() }); + has_conflict = true; + } } auto invite_id = add_client->GetPendingExpeditionInviteID();