mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 21:29:17 +01:00
Merge pull request #2922 from kfeuz/Issue2576
Fixes NPE when calling ip() on disconnected clients.
This commit is contained in:
@@ -51,7 +51,6 @@ public class Client implements Runnable {
|
||||
|
||||
Thread thread;
|
||||
Socket socket;
|
||||
String ip;
|
||||
int port;
|
||||
String host;
|
||||
|
||||
@@ -274,7 +273,10 @@ public class Client implements Runnable {
|
||||
* @brief Returns the IP address of the machine as a String
|
||||
*/
|
||||
public String ip() {
|
||||
return socket.getInetAddress().getHostAddress();
|
||||
if (socket != null){
|
||||
return socket.getInetAddress().getHostAddress();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user