From 08e81c1858106eb1f4d7a53106249def8b4bda35 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 1 Feb 2005 00:25:12 +0000 Subject: [PATCH] (operator/): Added a more complete divide-by-zero check. --- amount.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amount.cc b/amount.cc index 8771e944..729d12f5 100644 --- a/amount.cc +++ b/amount.cc @@ -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;