diff options
author | John Wiegley <johnw@newartisans.com> | 2006-03-24 16:37:26 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:31 -0400 |
commit | a5aff9eee967adb8c71ce6fc25db0458d522836e (patch) | |
tree | 1ab913955246a1ba0afd19d1f2fc776797a046d7 /balance.cc | |
parent | 44561c1c1d233d9432de319a71b44a3e05275d49 (diff) | |
download | ledger-a5aff9eee967adb8c71ce6fc25db0458d522836e.tar.gz ledger-a5aff9eee967adb8c71ce6fc25db0458d522836e.tar.bz2 ledger-a5aff9eee967adb8c71ce6fc25db0458d522836e.zip |
Several fixes to lot price handling.
Diffstat (limited to 'balance.cc')
-rw-r--r-- | balance.cc | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -197,9 +197,8 @@ balance_t& balance_t::operator*=(const amount_t& amt) i++) (*i).second *= amt; } - else if (amounts.size() == 1 && - (*amounts.begin()).first == &amt.commodity()) { - (*amounts.begin()).second *= amt; + else if (amounts.size() == 1) { + *this = (*amounts.begin()).second * amt; } else { amounts_map::iterator i = amounts.find(&amt.commodity()); @@ -208,9 +207,8 @@ balance_t& balance_t::operator*=(const amount_t& amt) } else { // Try stripping annotations before giving an error. balance_t temp(strip_annotations()); - if (temp.amounts.size() == 1 && - (*temp.amounts.begin()).first == &amt.commodity()) { - return *this = temp * amt; + if (temp.amounts.size() == 1) { + return *this = (*temp.amounts.begin()).second * amt; } else { i = temp.amounts.find(&amt.commodity()); if (i != temp.amounts.end()) |