Skip to content

Commit

Permalink
Add null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
chimp1984 committed Jan 4, 2021
1 parent 9e27504 commit f588b22
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ public OfferBookViewModel(User user,
};

// If our accounts have changed we reset our myInsufficientTradeLimitCache as it depends on account data
user.getPaymentAccountsAsObservable().addListener((SetChangeListener<PaymentAccount>) c ->
myInsufficientTradeLimitCache.clear());
if (user != null) {
user.getPaymentAccountsAsObservable().addListener((SetChangeListener<PaymentAccount>) c ->
myInsufficientTradeLimitCache.clear());
}
}

@Override
Expand All @@ -234,7 +236,9 @@ protected void activate() {
}
tradeCurrencyCode.set(selectedTradeCurrency.getCode());

disableMatchToggle.set(user.getPaymentAccounts() == null || user.getPaymentAccounts().isEmpty());
if (user != null) {
disableMatchToggle.set(user.getPaymentAccounts() == null || user.getPaymentAccounts().isEmpty());
}
useOffersMatchingMyAccountsFilter = !disableMatchToggle.get() && isShowOffersMatchingMyAccounts();

fillAllTradeCurrencies();
Expand Down

0 comments on commit f588b22

Please sign in to comment.