mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
NPE fix.
This commit is contained in:
parent
474b022b6c
commit
65f444dbf8
1 changed files with 6 additions and 6 deletions
|
@ -28,12 +28,9 @@
|
|||
|
||||
package mage.remote;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InterfaceAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.net.*;
|
||||
import java.util.Enumeration;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -76,7 +73,10 @@ public class Connection {
|
|||
public String getURI() {
|
||||
if (host.equals("localhost")) {
|
||||
try {
|
||||
return transport + "://" + getLocalAddress().getHostAddress() + ":" + port + "/" + serialization;
|
||||
InetAddress inet = getLocalAddress();
|
||||
if (inet != null) {
|
||||
return transport + "://" + inet.getHostAddress() + ":" + port + "/" + serialization;
|
||||
}
|
||||
} catch (SocketException ex) {
|
||||
// just use localhost if can't find local ip
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue