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);
|
sock.recv((char *)&strLen, sizeof(int), 0);
|
||||||
clientIndex = ntohl(clientIndex);
|
clientIndex = ntohl(clientIndex);
|
||||||
strLen = ntohl(strLen);
|
strLen = ntohl(strLen);
|
||||||
|
if (!sock.connected())
|
||||||
|
return;
|
||||||
|
|
||||||
trackName.resize(strLen);
|
trackName.resize(strLen);
|
||||||
sock.recv(&trackName[0], strLen, 0);
|
if (!sock.recv(&trackName[0], strLen, 0))
|
||||||
if (!sock.connected())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// find track
|
// find track
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user