s4-socket: do not segfault if the socket is NULL