From 8ca6c6b8274585d641510b3f0a537fc66dbd47f4 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 1 Feb 2005 02:38:17 +0000 Subject: (convert_number): If the denominator is zero, report an error instead of crashing. --- gnucash.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gnucash.cc') diff --git a/gnucash.cc b/gnucash.cc index e6ef86d0..7912bec2 100644 --- a/gnucash.cc +++ b/gnucash.cc @@ -145,7 +145,12 @@ static amount_t convert_number(const std::string& number) amount_t amt(numer_str); amount_t den(denom_str); - return amt / den; + if (! den) { + have_error = "Denominator in entry is zero!"; + return amt; + } else { + return amt / den; + } } else { return amount_t(number); } -- cgit v1.2.3