mirror of
https://github.com/sparrowwallet/hummingbird.git
synced 2024-12-25 17:46:44 +00:00
Fix CryptoCoinInfo constructor.
This error can be triggered when network is null (because it is optional) and will throw a NullPointerException.
This commit is contained in:
parent
eb245e005a
commit
4bb1ae2301
1 changed files with 3 additions and 1 deletions
|
@ -4,6 +4,8 @@ import co.nstant.in.cbor.model.DataItem;
|
||||||
import co.nstant.in.cbor.model.Map;
|
import co.nstant.in.cbor.model.Map;
|
||||||
import co.nstant.in.cbor.model.UnsignedInteger;
|
import co.nstant.in.cbor.model.UnsignedInteger;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class CryptoCoinInfo extends RegistryItem {
|
public class CryptoCoinInfo extends RegistryItem {
|
||||||
public static final int TYPE_KEY = 1;
|
public static final int TYPE_KEY = 1;
|
||||||
public static final int NETWORK_KEY = 2;
|
public static final int NETWORK_KEY = 2;
|
||||||
|
@ -12,7 +14,7 @@ public class CryptoCoinInfo extends RegistryItem {
|
||||||
private final Integer network;
|
private final Integer network;
|
||||||
|
|
||||||
public CryptoCoinInfo(Integer type, 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");
|
throw new IllegalArgumentException("Goerli network can only be selected for Ethereum");
|
||||||
}
|
}
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
Loading…
Reference in a new issue