Add check in case bsqPrice is 0 (thrown an exception otherwise)

This commit is contained in:
chimp1984 2020-12-10 00:12:11 -05:00
parent 63fc486896
commit fae8ddad4b
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3

View file

@ -373,11 +373,15 @@ public class OfferUtil {
tradeStatisticsManager, tradeStatisticsManager,
30); 30);
Price bsqPrice = tuple.second; Price bsqPrice = tuple.second;
String inputValue = bsqFormatter.formatCoin(makerFee); if (bsqPrice.isPositive()) {
Volume makerFeeAsVolume = Volume.parse(inputValue, "BSQ"); String inputValue = bsqFormatter.formatCoin(makerFee);
Coin requiredBtc = bsqPrice.getAmountByVolume(makerFeeAsVolume); Volume makerFeeAsVolume = Volume.parse(inputValue, "BSQ");
Volume volumeByAmount = userCurrencyPrice.getVolumeByAmount(requiredBtc); Coin requiredBtc = bsqPrice.getAmountByVolume(makerFeeAsVolume);
return Optional.of(volumeByAmount); Volume volumeByAmount = userCurrencyPrice.getVolumeByAmount(requiredBtc);
return Optional.of(volumeByAmount);
} else {
return Optional.empty();
}
} }
} else { } else {
return Optional.empty(); return Optional.empty();