mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
JS: Fix add of zero for non-XRP.
This commit is contained in:
committed by
Stefan Thomas
parent
b759a9001a
commit
870e74c8f8
@@ -111,7 +111,17 @@ Amount.prototype.add = function (v) {
|
||||
result._is_negative = s.compareTo(BigInteger.ZERO) < 0;
|
||||
result._value = result._is_negative ? s.negate() : s;
|
||||
}
|
||||
else {
|
||||
else if (v.is_zero()) {
|
||||
result = this;
|
||||
}
|
||||
else if (this.is_zero()) {
|
||||
result = new Amount();
|
||||
result._is_native = false;
|
||||
result._currency = this._currency.clone();
|
||||
result._issuer = this._issuer.clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
var v1 = this._is_negative ? this._value.negate() : this._value;
|
||||
var o1 = this._offset;
|
||||
var v2 = v._is_negative ? v._value.negate() : v._value;
|
||||
|
||||
Reference in New Issue
Block a user