catch NPE (#655)

This commit is contained in:
m2049r 2020-03-08 22:29:02 +01:00 committed by GitHub
parent b978396a38
commit 9c921183ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -68,6 +68,9 @@ public class ExchangeEditText extends LinearLayout {
} }
boolean ok = true; boolean ok = true;
String nativeAmount = getNativeAmount(); String nativeAmount = getNativeAmount();
if (nativeAmount == null) {
ok = false;
} else {
try { try {
double amount = Double.parseDouble(nativeAmount); double amount = Double.parseDouble(nativeAmount);
if ((amount < min) || (amount > max)) { if ((amount < min) || (amount > max)) {
@ -78,6 +81,7 @@ public class ExchangeEditText extends LinearLayout {
Timber.e(ex.getLocalizedMessage()); Timber.e(ex.getLocalizedMessage());
ok = false; ok = false;
} }
}
if (!ok) { if (!ok) {
shakeAmountField(); shakeAmountField();
} }