Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Fix NPE in NetUtil if interface does not have a broadcast address (#5173
Browse files Browse the repository at this point in the history
)


Fixes #5172
Signed-off-by: Stefan Triller <stefan.triller@telekom.de>
  • Loading branch information
triller-telekom authored and sjsf committed Mar 2, 2018
1 parent fb49cb0 commit f33c88f
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -186,7 +186,10 @@ public static List<String> getAllBroadcastAddresses() {
for (InterfaceAddress interfaceAddress : interfaceAddresses) {
final InetAddress addr = interfaceAddress.getAddress();
if (addr instanceof Inet4Address && !addr.isLinkLocalAddress() && !addr.isLoopbackAddress()) {
broadcastAddresses.add(interfaceAddress.getBroadcast().getHostAddress());
InetAddress broadcast = interfaceAddress.getBroadcast();
if (broadcast != null) {
broadcastAddresses.add(broadcast.getHostAddress());
}
}
}
}
Expand Down

0 comments on commit f33c88f

Please sign in to comment.