FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge pull request #2922 from kfeuz/Issue2576 · codingjoe/processing@158a462 · GitHub

Repository navigation

Commit 158a462

Browse files
committed
Merge pull request processing#2922 from kfeuz/Issue2576
Fixes NPE when calling ip() on disconnected clients.
2 parents 8216119 + 4c15dc3 commit 158a462

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎java/libraries/net/src/processing/net/Client.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class Client implements Runnable {
5151

5252
Thread thread;
5353
Socket socket;
54-
String ip;
5554
int port;
5655
String host;
5756

@@ -274,7 +273,10 @@ public boolean active() {
274273
* @brief Returns the IP address of the machine as a String
275274
*/
276275
public String ip() {
277-
return socket.getInetAddress().getHostAddress();
276+
if (socket != null){
277+
return socket.getInetAddress().getHostAddress();
278+
}
279+
return null;
278280
}
279281

280282

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL