Skip to content

Commit

Permalink
Core/Group: Do not allow a player to invite himself
Browse files Browse the repository at this point in the history
Do not allow a player to invite himself in group.
Fix an edge case when inviting another player that would cause a crash.
Fix TrinityCore#17664

(cherry picked from commit bcfa47c)
  • Loading branch information
jackpoz authored and Krudor committed Jul 13, 2017
1 parent 20d4c8c commit fe3a057
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/server/game/Handlers/GroupHandler.cpp
Expand Up @@ -69,6 +69,13 @@ void WorldSession::HandlePartyInviteOpcode(WorldPackets::Party::PartyInviteClien
return;
}

// player trying to invite himself (most likely cheating)
if (player == GetPlayer())
{
SendPartyResult(PARTY_OP_INVITE, player->GetName(), ERR_BAD_PLAYER_NAME_S);
return;
}

// restrict invite to GMs
if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->IsGameMaster() && player->IsGameMaster())
{
Expand Down Expand Up @@ -160,6 +167,7 @@ void WorldSession::HandlePartyInviteOpcode(WorldPackets::Party::PartyInviteClien
}
if (!group->AddInvite(player))
{
group->RemoveAllInvites();
delete group;
return;
}
Expand Down

0 comments on commit fe3a057

Please sign in to comment.