Handle NPE when checking isSignWitnessTrade.

This commit is contained in:
jmacxx 2023-09-01 08:41:37 -05:00
parent 9813ae7574
commit e082eb1c86
No known key found for this signature in database
GPG Key ID: 155297BABFE94A1B

View File

@ -930,17 +930,21 @@ public class AccountAgeWitnessService {
}
public boolean isSignWitnessTrade(Trade trade) {
try {
checkNotNull(trade, "trade must not be null");
checkNotNull(trade.getOffer(), "offer must not be null");
Contract contract = checkNotNull(trade.getContract());
PaymentAccountPayload sellerPaymentAccountPayload = contract.getSellerPaymentAccountPayload();
PaymentAccountPayload sellerPaymentAccountPayload = checkNotNull(
contract.getSellerPaymentAccountPayload(), "paymentAccountPayload must not be null");
AccountAgeWitness myWitness = getMyWitness(sellerPaymentAccountPayload);
getAccountAgeWitnessUtils().witnessDebugLog(trade, myWitness);
return accountIsSigner(myWitness) &&
!peerHasSignedWitness(trade) &&
tradeAmountIsSufficient(trade.getAmount());
} catch (NullPointerException e) {
e.printStackTrace();
}
return false;
}
public String getSignInfoFromAccount(PaymentAccount paymentAccount) {