3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 02:35:52 +00:00

Check for null InetAddress in PeerAddress c'tor.

This commit is contained in:
Mike Hearn 2013-03-01 23:56:25 +01:00
parent 1175fe9588
commit 9a0950e578

View File

@ -25,6 +25,7 @@ import java.net.UnknownHostException;
import static com.google.bitcoin.core.Utils.uint32ToByteStreamLE;
import static com.google.bitcoin.core.Utils.uint64ToByteStreamLE;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* A PeerAddress holds an IP address and port number representing the network location of
@ -71,7 +72,7 @@ public class PeerAddress extends ChildMessage {
* Construct a peer address from a memorized or hardcoded address.
*/
public PeerAddress(InetAddress addr, int port, int protocolVersion) {
this.addr = addr;
this.addr = checkNotNull(addr);
this.port = port;
this.protocolVersion = protocolVersion;
this.services = BigInteger.ZERO;