From 47ed19777accbcdb618a5fb209fda596eef2ddd2 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Thu, 1 Nov 2012 14:37:48 -0700 Subject: [PATCH] Fix currency and issuer for STAmount addition. --- src/Amount.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Amount.cpp b/src/Amount.cpp index cacfe72a1..b022f54e8 100644 --- a/src/Amount.cpp +++ b/src/Amount.cpp @@ -773,8 +773,12 @@ STAmount::operator double() const STAmount operator+(const STAmount& v1, const STAmount& v2) { - if (v1.isZero()) return v2; if (v2.isZero()) return v1; + if (v1.isZero()) + { + // Result must be in terms of v1 currency and issuer. + return STAmount(v1.getFName(), v1.mCurrency, v1.mIssuer, v2.mValue, v2.mOffset, v2.mIsNegative); + } v1.throwComparable(v2); if (v1.mIsNative)