summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-04-07 06:34:25 +0000
committerJohn Wiegley <johnw@newartisans.com>2004-04-07 06:34:25 +0000
commit250248fd9e868e2afb7cd2b94506834d5542846b (patch)
tree9cb901a8cc7f5b37359da0a37a0ad8b4c7d58f99
parentc6c16589abd4845fd654ce87bb6cd0aeb0f79006 (diff)
downloadfork-ledger-250248fd9e868e2afb7cd2b94506834d5542846b.tar.gz
fork-ledger-250248fd9e868e2afb7cd2b94506834d5542846b.tar.bz2
fork-ledger-250248fd9e868e2afb7cd2b94506834d5542846b.zip
*** empty log message ***
-rw-r--r--amount.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/amount.cc b/amount.cc
index d6724640..4d6a9754 100644
--- a/amount.cc
+++ b/amount.cc
@@ -173,7 +173,8 @@ amount * gmp_amount::value(amount * pr) const
else
new_amt->quantity_comm = quantity_comm;
- if (new_amt->quantity_comm->precision < MAX_PRECISION)
+ if (new_amt->quantity_comm &&
+ new_amt->quantity_comm->precision < MAX_PRECISION)
round(new_amt->quantity, new_amt->quantity,
new_amt->quantity_comm->precision);
@@ -288,8 +289,7 @@ bool gmp_amount::is_zero() const
{
mpz_t copy;
mpz_init_set(copy, quantity);
- assert(quantity_comm);
- if (quantity_comm->precision < MAX_PRECISION)
+ if (quantity_comm && quantity_comm->precision < MAX_PRECISION)
round(copy, copy, quantity_comm->precision);
bool zero = mpz_sgn(copy) == 0;
mpz_clear(copy);