(operator/): Added a more complete divide-by-zero check.

This commit is contained in:
John Wiegley 2005-02-01 00:25:12 +00:00
parent 2474f28c0a
commit 08e81c1858

View file

@ -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;