Skip to content

Commit

Permalink
Merge pull request #6842 from jmacxx/fix_issue_6841
Browse files Browse the repository at this point in the history
Handle NPE when checking isSignWitnessTrade.
  • Loading branch information
alejandrogarcia83 authored Sep 6, 2023
2 parents f84ebc2 + e082eb1 commit c9f39a9
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -930,17 +930,21 @@ public Set<SignedWitness> getUnsignedSignerPubKeys() {
}

public boolean isSignWitnessTrade(Trade trade) {
checkNotNull(trade, "trade must not be null");
checkNotNull(trade.getOffer(), "offer must not be null");
Contract contract = checkNotNull(trade.getContract());
PaymentAccountPayload sellerPaymentAccountPayload = contract.getSellerPaymentAccountPayload();
AccountAgeWitness myWitness = getMyWitness(sellerPaymentAccountPayload);

getAccountAgeWitnessUtils().witnessDebugLog(trade, myWitness);

return accountIsSigner(myWitness) &&
!peerHasSignedWitness(trade) &&
tradeAmountIsSufficient(trade.getAmount());
try {
checkNotNull(trade, "trade must not be null");
checkNotNull(trade.getOffer(), "offer must not be null");
Contract contract = checkNotNull(trade.getContract());
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) {
Expand Down

0 comments on commit c9f39a9

Please sign in to comment.