Add null check

This commit is contained in:
Manfred Karrer 2016-05-16 21:32:19 +02:00
parent c538ad1ba6
commit cfd2e837e9

View file

@ -863,7 +863,11 @@ public class MainViewModel implements ViewModel {
private void updateLockedBalance() {
Coin sum = Coin.valueOf(tradeManager.getLockedTradeStream()
.mapToLong(trade -> walletService.getOrCreateAddressEntry(trade.getId(), AddressEntry.Context.MULTI_SIG).getLockedTradeAmount().getValue())
.mapToLong(trade -> {
//AddressEntry addressEntry = walletService.getOrCreateAddressEntry(trade.getId(), AddressEntry.Context.MULTI_SIG);
Coin lockedTradeAmount = walletService.getOrCreateAddressEntry(trade.getId(), AddressEntry.Context.MULTI_SIG).getLockedTradeAmount();
return lockedTradeAmount != null ? lockedTradeAmount.getValue() : 0;
})
.sum());
lockedBalance.set(formatter.formatCoinWithCode(sum));
}