editor: prevent crash on early disconnection
With some really bad luck, it was possible to crash inside std::string::resize() if the connection was disconnected right after sending the GET_TRACK command.
This commit is contained in:
parent
9da5e1b3d4
commit
126fbe1c33
@ -575,10 +575,11 @@ void processCommand(NetworkSocket &sock)
|
||||
sock.recv((char *)&strLen, sizeof(int), 0);
|
||||
clientIndex = ntohl(clientIndex);
|
||||
strLen = ntohl(strLen);
|
||||
if (!sock.connected())
|
||||
return;
|
||||
|
||||
trackName.resize(strLen);
|
||||
sock.recv(&trackName[0], strLen, 0);
|
||||
if (!sock.connected())
|
||||
if (!sock.recv(&trackName[0], strLen, 0))
|
||||
return;
|
||||
|
||||
// find track
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user