summaryrefslogtreecommitdiff
path: root/amount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'amount.cc')
-rw-r--r--amount.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/amount.cc b/amount.cc
index b72f9852..e0507c7c 100644
--- a/amount.cc
+++ b/amount.cc
@@ -276,11 +276,12 @@ amount_t& amount_t::operator=(const char * value)
// assignment operator
amount_t& amount_t::operator=(const amount_t& amt)
{
- if (amt.quantity)
- _copy(amt);
- else if (quantity)
- _clear();
-
+ if (this != &amt) {
+ if (amt.quantity)
+ _copy(amt);
+ else if (quantity)
+ _clear();
+ }
return *this;
}