Add null check to selected arbitrator

This commit is contained in:
Manfred Karrer 2016-04-05 12:41:43 +02:00
parent 4c0cc738e4
commit bc734fe51b

View File

@ -18,6 +18,7 @@
package io.bitsquare.trade.protocol.trade;
import io.bitsquare.app.Version;
import io.bitsquare.arbitration.Arbitrator;
import io.bitsquare.arbitration.ArbitratorManager;
import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.TradeWalletService;
@ -50,6 +51,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
public class ProcessModel implements Model, Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
@ -145,7 +148,9 @@ public class ProcessModel implements Model, Serializable {
}
public byte[] getArbitratorPubKey(NodeAddress arbitratorNodeAddress) {
return user.getAcceptedArbitratorByAddress(arbitratorNodeAddress).getBtcPubKey();
Arbitrator acceptedArbitratorByAddress = user.getAcceptedArbitratorByAddress(arbitratorNodeAddress);
checkNotNull(acceptedArbitratorByAddress, "acceptedArbitratorByAddress must not be null. Maybe there is no arbitrator in the network available.");
return acceptedArbitratorByAddress.getBtcPubKey();
}
public Offer getOffer() {