Skip to content

Commit

Permalink
Verify closedTradableManager.getTradableById return value is a Trade …
Browse files Browse the repository at this point in the history
…instance

This change requested at #4711 (comment)
  • Loading branch information
ghubstan committed Oct 31, 2020
1 parent c27d5a6 commit fcdfc68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/bisq/core/api/CoreTradesService.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.offer.Offer;
import bisq.core.offer.takeoffer.TakeOfferModel;
import bisq.core.trade.Tradable;
import bisq.core.trade.Trade;
import bisq.core.trade.TradeManager;
import bisq.core.trade.TradeUtil;
Expand Down Expand Up @@ -199,7 +200,8 @@ private Optional<Trade> getOpenTrade(String tradeId) {
}

private Optional<Trade> getClosedTrade(String tradeId) {
return closedTradableManager.getTradableById(tradeId).map(value -> (Trade) value);
Optional<Tradable> tradable = closedTradableManager.getTradableById(tradeId);
return tradable.filter((t) -> t instanceof Trade).map(value -> (Trade) value);
}

private boolean isFollowingBuyerProtocol(Trade trade) {
Expand Down

0 comments on commit fcdfc68

Please sign in to comment.