abort exchange if amount is invalid

This commit is contained in:
m2049r 2017-11-03 01:20:59 +01:00
parent 0e187d3b20
commit f951e1a621
1 changed files with 2 additions and 0 deletions

View File

@ -284,6 +284,7 @@ public class ExchangeView extends LinearLayout implements AsyncExchangeRate.List
public void exchange(double rate) {
if (getCurrencyA() == 0) {
if (xmrAmount == null) return;
if (!xmrAmount.isEmpty() && (rate > 0)) {
double amountB = rate * Double.parseDouble(xmrAmount);
notXmrAmount = Helper.getFormattedAmount(amountB, getCurrencyB() == 0);
@ -292,6 +293,7 @@ public class ExchangeView extends LinearLayout implements AsyncExchangeRate.List
}
tvAmountB.setText(notXmrAmount);
} else if (getCurrencyB() == 0) {
if (notXmrAmount == null) return;
if (!notXmrAmount.isEmpty() && (rate > 0)) {
double amountB = rate * Double.parseDouble(notXmrAmount);
setXmr(Helper.getFormattedAmount(amountB, true));