Scenario of (invalid) or (connection) names breaking /swap

Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
houseme-kyle 2021-03-21 10:58:50 +02:00 committed by GitHub
parent 35991ea973
commit 6ecd326b4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -705,7 +705,7 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
int TargetClientId = -1;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(!str_comp(pName, pSelf->Server()->ClientName(i)))
if(pSelf->m_apPlayers[i] && !str_comp(pName, pSelf->Server()->ClientName(i)))
{
TargetClientId = i;
break;