Prevent NPE in case delayedPayoutTx is not present (failed trade)

This commit is contained in:
jmacxx 2021-11-02 10:42:25 -05:00
parent 9f60146b96
commit c916e9b749
No known key found for this signature in database
GPG Key ID: 155297BABFE94A1B

View File

@ -493,7 +493,8 @@ public class PendingTradesDataModel extends ActivatableDataModel {
}
Trade.DisputeState disputeState = trade.getDisputeState();
DisputeManager<? extends DisputeList<Dispute>> disputeManager;
long remainingLockTime = trade.getDelayedPayoutTx().getLockTime() - btcWalletService.getBestChainHeight();
long lockTime = trade.getDelayedPayoutTx() == null ? trade.getLockTime() : trade.getDelayedPayoutTx().getLockTime();
long remainingLockTime = lockTime - btcWalletService.getBestChainHeight();
// In case we re-open a dispute we allow Trade.DisputeState.MEDIATION_REQUESTED
boolean useMediation = disputeState == Trade.DisputeState.NO_DISPUTE ||
(disputeState == Trade.DisputeState.MEDIATION_REQUESTED && remainingLockTime > 0);