Skip to content

Commit

Permalink
Merge pull request #5797 from jmacxx/fix_exception_opening_mediation
Browse files Browse the repository at this point in the history
Prevent NPE in case delayedPayoutTx is not present (failed trade)
  • Loading branch information
ripcurlx authored Nov 4, 2021
2 parents 928208c + c916e9b commit 851bdcf
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,8 @@ private void doOpenDispute(boolean isSupportTicket, Transaction depositTx) {
}
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);
Expand Down

0 comments on commit 851bdcf

Please sign in to comment.