From 4bb1ae23010ec55aa9b5a1de2f184ff0eb261fb1 Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Mon, 21 Oct 2024 13:56:38 +0200 Subject: [PATCH] Fix CryptoCoinInfo constructor. This error can be triggered when network is null (because it is optional) and will throw a NullPointerException. --- .../sparrowwallet/hummingbird/registry/CryptoCoinInfo.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/sparrowwallet/hummingbird/registry/CryptoCoinInfo.java b/src/main/java/com/sparrowwallet/hummingbird/registry/CryptoCoinInfo.java index cf4dcca..cf5c54d 100644 --- a/src/main/java/com/sparrowwallet/hummingbird/registry/CryptoCoinInfo.java +++ b/src/main/java/com/sparrowwallet/hummingbird/registry/CryptoCoinInfo.java @@ -4,6 +4,8 @@ import co.nstant.in.cbor.model.DataItem; import co.nstant.in.cbor.model.Map; import co.nstant.in.cbor.model.UnsignedInteger; +import java.util.Objects; + public class CryptoCoinInfo extends RegistryItem { public static final int TYPE_KEY = 1; public static final int NETWORK_KEY = 2; @@ -12,7 +14,7 @@ public class CryptoCoinInfo extends RegistryItem { private final Integer network; public CryptoCoinInfo(Integer type, Integer network) { - if(network.equals(Network.GOERLI.networkValue) && !type.equals(Type.ETHEREUM.typeValue)) { + if(Objects.equals(network, Network.GOERLI.networkValue) && !Objects.equals(type, Type.ETHEREUM.typeValue)) { throw new IllegalArgumentException("Goerli network can only be selected for Ethereum"); } this.type = type;