Relax handling of bad numeric values in the DOM parser.

string_to_gnc_numeric returns a nullptr if the GncNumeric string
constructor decides that the denominator is 0. The 2.6 version of the
function didn't check for this and occasionally stored error values.
Convert that to gnc_numeric_zero to allow the file to be processed.
This commit is contained in:
John Ralls 2017-07-15 17:05:10 -07:00
parent 72f95238fb
commit b8fc9df87b

View File

@ -517,23 +517,15 @@ gnc_numeric*
dom_tree_to_gnc_numeric (xmlNodePtr node)
{
gchar* content = dom_tree_to_text (node);
gnc_numeric* ret;
if (!content)
return NULL;
ret = g_new (gnc_numeric, 1);
gnc_numeric *ret = g_new (gnc_numeric, 1);
if (string_to_gnc_numeric (content, ret))
{
g_free (content);
return ret;
}
else
{
g_free (content);
g_free (ret);
return NULL;
}
if (!string_to_gnc_numeric (content, ret))
*ret = gnc_numeric_zero ();
g_free (content);
return ret;
}
static inline Timespec