fix npe in offer payment account selection

This commit is contained in:
woodser 2023-05-20 10:00:22 -04:00
parent 5aba26ff82
commit 02eb2fb005

View file

@ -255,10 +255,10 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
@NotNull @NotNull
private Optional<PaymentAccount> getAnyPaymentAccount() { private Optional<PaymentAccount> getAnyPaymentAccount() {
if (CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode())) { if (CurrencyUtil.isFiatCurrency(tradeCurrency.getCode())) {
return paymentAccounts.stream().filter(paymentAccount1 -> !paymentAccount1.getPaymentMethod().isCrypto()).findAny(); return paymentAccounts.stream().filter(paymentAccount1 -> paymentAccount1.isFiat()).findAny();
} else { } else {
return paymentAccounts.stream().filter(paymentAccount1 -> paymentAccount1.getPaymentMethod().isCrypto() && return paymentAccounts.stream().filter(paymentAccount1 -> !paymentAccount1.isFiat() &&
paymentAccount1.getTradeCurrency().isPresent() && paymentAccount1.getTradeCurrency().isPresent() &&
!Objects.equals(paymentAccount1.getTradeCurrency().get().getCode(), GUIUtil.TOP_CRYPTO.getCode())).findAny(); !Objects.equals(paymentAccount1.getTradeCurrency().get().getCode(), GUIUtil.TOP_CRYPTO.getCode())).findAny();
} }