From a072b7e2087fcd4dd5cbd1f8b652da2af9585808 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 9 Feb 2009 15:07:45 -0400 Subject: [PATCH] Fixed a case where adding an amount to an integer failed. --- src/value.cc | 4 ++++ 1 file changed, 4 insertions(+) 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;