Commit 36771bbf by Jason Song Committed by GitHub

Merge pull request #596 from nobodyiam/fix-coverity-bug

fix coverity bug
parents 37788d86 dc38354f
...@@ -98,8 +98,12 @@ public enum NetworkInterfaceManager { ...@@ -98,8 +98,12 @@ public enum NetworkInterfaceManager {
try { try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
List<NetworkInterface> nis = interfaces == null ? Collections.<NetworkInterface>emptyList() List<NetworkInterface> nis;
: Collections.list(NetworkInterface.getNetworkInterfaces()); if (interfaces == null) {
nis = Collections.emptyList();
} else {
nis = Collections.list(NetworkInterface.getNetworkInterfaces());
}
List<InetAddress> addresses = new ArrayList<InetAddress>(); List<InetAddress> addresses = new ArrayList<InetAddress>();
InetAddress local = null; InetAddress local = null;
...@@ -113,9 +117,14 @@ public enum NetworkInterfaceManager { ...@@ -113,9 +117,14 @@ public enum NetworkInterfaceManager {
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
} }
m_local = local; if (local != null) {
m_local = local;
return;
}
} catch (SocketException e) { } catch (SocketException e) {
// ignore it // ignore it
} }
m_local = InetAddress.getLoopbackAddress();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment