Fixes Issue #2576 NPE when calling ip() on disconnected clients.

This commit is contained in:
Kyle Feuz
2014-06-10 01:37:46 -07:00
parent d25c149b49
commit 94e01acb7b

View File

@@ -77,6 +77,7 @@ public class Client implements Runnable {
socket = new Socket(this.host, this.port);
input = socket.getInputStream();
output = socket.getOutputStream();
ip = socket.getInetAddress().getHostAddress();
thread = new Thread(this);
thread.start();
@@ -123,6 +124,7 @@ public class Client implements Runnable {
input = socket.getInputStream();
output = socket.getOutputStream();
ip = socket.getInetAddress().getHostAddress();
thread = new Thread(this);
thread.start();
@@ -274,7 +276,7 @@ public class Client implements Runnable {
* @brief Returns the IP address of the machine as a String
*/
public String ip() {
return socket.getInetAddress().getHostAddress();
return ip;
}