gnucash maint: [gnc-engine-guile.c] return #f when gnc_numeric has error

Christopher Lam clam at code.gnucash.org
Sun Nov 22 19:09:07 EST 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/8f329921 (commit)
	from  https://github.com/Gnucash/gnucash/commit/d11bdb3e (commit)



commit 8f32992100c6b1ca2554b023d3cf6df2b8aafca7
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Nov 23 07:48:57 2020 +0800

    [gnc-engine-guile.c] return #f when gnc_numeric has error
    
    otherwise it'd throw guile div/0 exception

diff --git a/bindings/guile/gnc-engine-guile.c b/bindings/guile/gnc-engine-guile.c
index 06daad9e2..ada25aab5 100644
--- a/bindings/guile/gnc-engine-guile.c
+++ b/bindings/guile/gnc-engine-guile.c
@@ -1731,8 +1731,8 @@ gnc_scm_to_numeric(SCM gncnum)
 SCM
 gnc_numeric_to_scm(gnc_numeric arg)
 {
-    return scm_divide(scm_from_int64(arg.num),
-                           scm_from_int64(arg.denom));
+    return gnc_numeric_check (arg) ? SCM_BOOL_F :
+        scm_divide (scm_from_int64 (arg.num), scm_from_int64 (arg.denom));
 }
 
 static SCM



Summary of changes:
 bindings/guile/gnc-engine-guile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list