Skip to content

Commit

Permalink
Add null checks in PendingTradesViewModel
Browse files Browse the repository at this point in the history
These changes were requested in review of PR
bisq-network#4699
  • Loading branch information
ghubstan committed Oct 30, 2020
1 parent c2f8db3 commit 0656c57
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,22 @@ String getMarketLabel(PendingTradesListItem item) {
}

public String getRemainingTradeDurationAsWords() {
checkNotNull(dataModel.getTrade(), "model's trade must not be null");
return tradeUtil.getRemainingTradeDurationAsWords(dataModel.getTrade());
}

public double getRemainingTradeDurationAsPercentage() {
checkNotNull(dataModel.getTrade(), "model's trade must not be null");
return tradeUtil.getRemainingTradeDurationAsPercentage(dataModel.getTrade());
}

public String getDateForOpenDispute() {
checkNotNull(dataModel.getTrade(), "model's trade must not be null");
return DisplayUtils.formatDateTime(tradeUtil.getDateForOpenDispute(dataModel.getTrade()));
}

public boolean showWarning() {
checkNotNull(dataModel.getTrade(), "model's trade must not be null");
Date halfTradePeriodDate = tradeUtil.getHalfTradePeriodDate(dataModel.getTrade());
return halfTradePeriodDate != null && new Date().after(halfTradePeriodDate);
}
Expand Down

0 comments on commit 0656c57

Please sign in to comment.