summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-09 15:07:45 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-09 15:07:45 -0400
commita072b7e2087fcd4dd5cbd1f8b652da2af9585808 (patch)
tree5c22619df61f23fb9d097d673a40fdc82502b5ce
parent37a1989ca0b47308acee386f0976cb2da57eeedd (diff)
downloadfork-ledger-a072b7e2087fcd4dd5cbd1f8b652da2af9585808.tar.gz
fork-ledger-a072b7e2087fcd4dd5cbd1f8b652da2af9585808.tar.bz2
fork-ledger-a072b7e2087fcd4dd5cbd1f8b652da2af9585808.zip
Fixed a case where adding an amount to an integer failed.
-rw-r--r--src/value.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index 724d87fc..d28883a4 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -390,6 +390,10 @@ value_t& value_t::operator+=(const value_t& val)
as_long_lval() += val.as_long();
return *this;
case AMOUNT:
+ if (val.as_amount().has_commodity()) {
+ in_place_cast(BALANCE);
+ return *this += val;
+ }
in_place_cast(AMOUNT);
as_amount_lval() += val.as_amount();
return *this;