Fix NULL socket crash
In some cases, when server closes unexpectendly the client may try to send data to the server while it's socket has already been destroyed, provoking a segfault. This fixes it.
In some cases, when server closes unexpectendly the client may try to send data to the server while it's socket has already been destroyed, provoking a segfault. This fixes it.