summaryrefslogtreecommitdiff
path: root/balance.cc
diff options
context:
space:
mode:
Diffstat (limited to 'balance.cc')
-rw-r--r--balance.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/balance.cc b/balance.cc
index 86292781..70f9bfce 100644
--- a/balance.cc
+++ b/balance.cc
@@ -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())