Throw an exception if mpfr_asprintf fails

This commit is contained in:
John Wiegley 2010-06-02 04:01:16 -04:00
parent 10df662166
commit 75363003bd

View file

@ -130,7 +130,10 @@ namespace {
mpfr_set_prec(tempfb, bits + amount_t::extend_by_digits*8);
mpfr_set_q(tempfb, quant, GMP_RNDN);
mpfr_asprintf(&buf, "%.*Rf", prec, tempfb);
if (mpfr_asprintf(&buf, "%.*Rf", prec, tempfb) < 0)
throw_(amount_error,
_("Cannot output amount to a floating-point representation"));
DEBUG("amount.convert",
"mpfr_print = " << buf << " (precision " << prec << ")");