(operator/): Added a more complete divide-by-zero check.
This commit is contained in:
parent
2474f28c0a
commit
08e81c1858
1 changed files with 1 additions and 1 deletions
|
|
@ -408,7 +408,7 @@ amount_t& amount_t::operator*=(const amount_t& amt)
|
|||
|
||||
amount_t& amount_t::operator/=(const amount_t& amt)
|
||||
{
|
||||
if (! amt.quantity)
|
||||
if (! amt.quantity || ! amt)
|
||||
throw amount_error("Divide by zero");
|
||||
else if (! quantity)
|
||||
return *this;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue