mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 11:21:06 +01:00
Fixes Issue #2576 NPE when calling ip() on disconnected clients.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user