diff --git a/src/client.cpp b/src/client.cpp index 2505333d7d..00b1c7d99a 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1012,6 +1012,14 @@ void CClient::OnClientIDReceived ( int iServerChanID ) // allocate and map client-side channel 0 int iChanID = FindClientChannel ( iServerChanID, true ); // should always return channel 0 + // make sure we got a real channel (should never occur) + if ( iChanID == INVALID_INDEX ) + { + Stop(); // stops audio and channel, sets CS_DISCONNECTED + emit ConnectingFailed ( tr ( "Unexpected client ID." ) ); + return; + } + // for headless mode we support to mute our own signal in the personal mix // (note that the check for headless is done in the main.cpp and must not // be checked here)