Fixes NPE when calling ip() on disconnected clients.

As discussed in Issue #2576 the correct behavior is to return null if the client has disconnected.  I have updated the code to prevent the NPE and to return null if the client has disconnected.