From 2ca94de24156f592fa8f7840228285e320808124 Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 01:34:48 -0500 Subject: [PATCH] -In the send assets screen it crashes when type an amount --- .../validators/validationfields/AmountValidationField.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java index 3b44223..a01f1a8 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java +++ b/app/src/main/java/cy/agorise/crystalwallet/viewmodels/validators/validationfields/AmountValidationField.java @@ -48,7 +48,12 @@ public class AmountValidationField extends ValidationField { CryptoCoinBalance balance = CrystalDatabase.getAppDatabase(amountField.getContext()).cryptoCoinBalanceDao().getBalanceFromAccount(this.account.getId(),cryptoCurrency.getId()); - if (newAmountValue > balance.getBalance()){ + double balanceDouble = 0; + if(balance != null){ + balanceDouble = balance.getBalance(); + } + + if (newAmountValue > balanceDouble){ setMessageForValue(mixedValues, validator.getContext().getResources().getString(R.string.insufficient_amount)); setValidForValue(mixedValues, false); } else if (newAmountValue == 0){