Bug 798616 - Can't register amount greater than 9,000,000,000

Because when loading the value the split in the xml backend doesn't yet
have a parent so the code tried to convert to GNC_COMMODITY_MAX_FRACTION
and if the numerator was larger than 10^10 that would overflow.

To fix it this changes the "don't know" response to get_currency_denom
and get_commodity_denom to GNC_DENOM_AUTO which will normally leave
the denominator alone.
This commit is contained in:
John Ralls 2022-09-19 18:06:26 -07:00
parent 1752f1d19d
commit 7c350c3ae5

View File

@ -1130,13 +1130,9 @@ xaccSplitDetermineGainStatus (Split *split)
static inline int
get_currency_denom(const Split * s)
{
if (!s)
if (!(s && s->parent && s->parent->common_currency))
{
return 0;
}
else if (!s->parent || !s->parent->common_currency)
{
return GNC_COMMODITY_MAX_FRACTION;
return GNC_DENOM_AUTO;
}
else
{
@ -1147,13 +1143,9 @@ get_currency_denom(const Split * s)
static inline int
get_commodity_denom(const Split * s)
{
if (!s)
if (!(s && s->acc))
{
return 0;
}
else if (!s->acc)
{
return GNC_COMMODITY_MAX_FRACTION;
return GNC_DENOM_AUTO;
}
else
{