mirror of https://github.com/m2049r/xmrwallet.git
abort exchange if amount is invalid
This commit is contained in:
parent
0e187d3b20
commit
f951e1a621
|
@ -284,6 +284,7 @@ public class ExchangeView extends LinearLayout implements AsyncExchangeRate.List
|
||||||
|
|
||||||
public void exchange(double rate) {
|
public void exchange(double rate) {
|
||||||
if (getCurrencyA() == 0) {
|
if (getCurrencyA() == 0) {
|
||||||
|
if (xmrAmount == null) return;
|
||||||
if (!xmrAmount.isEmpty() && (rate > 0)) {
|
if (!xmrAmount.isEmpty() && (rate > 0)) {
|
||||||
double amountB = rate * Double.parseDouble(xmrAmount);
|
double amountB = rate * Double.parseDouble(xmrAmount);
|
||||||
notXmrAmount = Helper.getFormattedAmount(amountB, getCurrencyB() == 0);
|
notXmrAmount = Helper.getFormattedAmount(amountB, getCurrencyB() == 0);
|
||||||
|
@ -292,6 +293,7 @@ public class ExchangeView extends LinearLayout implements AsyncExchangeRate.List
|
||||||
}
|
}
|
||||||
tvAmountB.setText(notXmrAmount);
|
tvAmountB.setText(notXmrAmount);
|
||||||
} else if (getCurrencyB() == 0) {
|
} else if (getCurrencyB() == 0) {
|
||||||
|
if (notXmrAmount == null) return;
|
||||||
if (!notXmrAmount.isEmpty() && (rate > 0)) {
|
if (!notXmrAmount.isEmpty() && (rate > 0)) {
|
||||||
double amountB = rate * Double.parseDouble(notXmrAmount);
|
double amountB = rate * Double.parseDouble(notXmrAmount);
|
||||||
setXmr(Helper.getFormattedAmount(amountB, true));
|
setXmr(Helper.getFormattedAmount(amountB, true));
|
||||||
|
|
Loading…
Reference in New Issue