Core/Group: Do not allow a player to invite himself

Do not allow a player to invite himself in group.
Fix an edge case when inviting another player that would cause a crash.
Fix #17664
This commit is contained in:
jackpoz authored and Aokromes committed 2016-08-03 11:56:29 +02:00
1 parent 3ed49467ba
commit 242917e461
1 file changed
+8
@@ -114,6 +114,13 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
return;
}
// player trying to invite himself (most likely cheating)
if (player == GetPlayer())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
return;
}
// restrict invite to GMs
if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->IsGameMaster() && player->IsGameMaster())
{
@@ -256,6 +263,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
}
if (!group->AddInvite(player))
{
group->RemoveAllInvites();
delete group;
return;
}