[Gnucash-changes] add check for null pointer

Linas Vepstas linas at cvs.gnucash.org
Thu Jul 8 23:09:33 EDT 2004


Log Message:
-----------
add check for null pointer

Modified Files:
--------------
    gnucash/src/engine:
        Transaction.c

Revision Data
-------------
Index: Transaction.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/Transaction.c,v
retrieving revision 1.314
retrieving revision 1.315
diff -Lsrc/engine/Transaction.c -Lsrc/engine/Transaction.c -u -r1.314 -r1.315
--- src/engine/Transaction.c
+++ src/engine/Transaction.c
@@ -1561,6 +1561,9 @@
 xaccTransCommitEdit (Transaction *trans)
 {
    QofBackend *be;
+
+   if (!trans) return;
+
    QOF_COMMIT_EDIT_PART1 (&trans->inst);
 
    /* We increment this for the duration of the call
@@ -2844,8 +2847,9 @@
    * handle some overflow and other error conditions by returning
    * zero.  But still print an error to let us know it happened.
    */
-  if (gnc_numeric_check(price)) {
-    PERR("Computing Shares Price Failed (%d): [ %lld / %lld ] / [ %lld / %lld ]",
+  if (gnc_numeric_check(price)) 
+  {
+    PERR("Computing share price failed (%d): [ %lld / %lld ] / [ %lld / %lld ]",
 	 gnc_numeric_check(price), val.num, val.denom, amt.num, amt.denom);
     return gnc_numeric_create(0,1);
   }


More information about the gnucash-changes mailing list