diff options
author | John Wiegley <johnw@newartisans.com> | 2019-01-11 16:25:02 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2019-01-11 16:26:03 -0800 |
commit | 56025cdefc07e30b025c65146affc141888b2f83 (patch) | |
tree | 821548d29ba53217c51eff6fb2043fd2b32267b5 /src/amount.cc | |
parent | 863cb3bdb7bc3650873253e108b26eb3fe15862d (diff) | |
download | fork-ledger-56025cdefc07e30b025c65146affc141888b2f83.tar.gz fork-ledger-56025cdefc07e30b025c65146affc141888b2f83.tar.bz2 fork-ledger-56025cdefc07e30b025c65146affc141888b2f83.zip |
Don't attempt to invert a value if it's already zero (#1703)
Diffstat (limited to 'src/amount.cc')
-rw-r--r-- | src/amount.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/amount.cc b/src/amount.cc index 05145f87..c6463b2b 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -604,7 +604,9 @@ void amount_t::in_place_invert() throw_(amount_error, _("Cannot invert an uninitialized amount")); _dup(); - mpq_inv(MP(quantity), MP(quantity)); + + if (sign() != 0) + mpq_inv(MP(quantity), MP(quantity)); } void amount_t::in_place_round() |