prevents division by zero
This commit is contained in:
parent
9bf571bdd7
commit
b3fcdf8584
2 changed files with 3 additions and 2 deletions
|
|
@ -137,6 +137,7 @@ angular.module('copayApp.controllers').controller('inputAmountController', funct
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (result == 'Infinity') return null;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -347,13 +347,13 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setAmount = function(amount, alternativeAmount, useAlternativeAmount) {
|
this.setAmount = function(amount, alternativeAmount, useAlternativeAmount) {
|
||||||
|
$scope.showAlternative = useAlternativeAmount;
|
||||||
var amountResult;
|
var amountResult;
|
||||||
|
|
||||||
if (useAlternativeAmount) {
|
if (useAlternativeAmount) {
|
||||||
amountResult = parseFloat((rateService.fromFiat(alternativeAmount, self.alternativeIsoCode) * self.satToUnit).toFixed(self.unitDecimals), 10);
|
amountResult = parseFloat((rateService.fromFiat(alternativeAmount, self.alternativeIsoCode) * self.satToUnit).toFixed(self.unitDecimals), 10);
|
||||||
$scope.showAlternative = true;
|
|
||||||
} else {
|
} else {
|
||||||
amountResult = amount;
|
amountResult = amount;
|
||||||
$scope.showAlternative = false;
|
|
||||||
}
|
}
|
||||||
self.setForm(null, amountResult, null);
|
self.setForm(null, amountResult, null);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue