Skip to content

Commit 8a668a0

Browse files
fix(api): Add nullcheck to IpAddress##parseHostAddress (#5733)
add nullcheck
1 parent ddef8d6 commit 8a668a0

File tree

1 file changed

+1
-1
lines changed
  • kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/net

1 file changed

+1
-1
lines changed

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/net/IPAddress.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static IPAddress getByAddress(int addr) throws UnknownHostException {
8383
* @return
8484
*/
8585
public static IPAddress parseHostAddress(String hostAddress) throws UnknownHostException {
86-
if (!hostAddress.isEmpty() && !InetAddresses.isInetAddress(hostAddress)) {
86+
if (hostAddress != null && !hostAddress.isEmpty() && !InetAddresses.isInetAddress(hostAddress)) {
8787
throw new UnknownHostException("Invalid IP address: " + hostAddress);
8888
}
8989

0 commit comments

Comments
 (0)