diff options
author | John Wiegley <johnw@newartisans.com> | 2005-02-01 02:38:17 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:40:52 -0400 |
commit | 8ca6c6b8274585d641510b3f0a537fc66dbd47f4 (patch) | |
tree | 47b131e524ad104ba775fcb924ddd89f79d446c8 /gnucash.cc | |
parent | d6475fc4a26826c55f613549588022d3c4803efa (diff) | |
download | fork-ledger-8ca6c6b8274585d641510b3f0a537fc66dbd47f4.tar.gz fork-ledger-8ca6c6b8274585d641510b3f0a537fc66dbd47f4.tar.bz2 fork-ledger-8ca6c6b8274585d641510b3f0a537fc66dbd47f4.zip |
(convert_number): If the denominator is zero, report an error instead
of crashing.
Diffstat (limited to 'gnucash.cc')
-rw-r--r-- | gnucash.cc | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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); } |