[gnc-exp-parser] don't crash when gnc:fn returns non-number

if gnc:fn returns anything other than a number, abort rather than
crash
This commit is contained in:
Christopher Lam 2020-04-14 23:40:37 +08:00
parent 8f68d54292
commit 6de712b501

View File

@ -339,6 +339,12 @@ func_op(const char *fname, int argc, void **argv)
return NULL;
}
if (!scm_is_number (scmTmp))
{
PERR("function gnc:%s does not return a number", fname);
return NULL;
}
result = g_new0( gnc_numeric, 1 );
*result = double_to_gnc_numeric( scm_to_double(scmTmp),
GNC_DENOM_AUTO,