r18508 - gnucash/trunk/src/engine - Teach xaccSplitConvertAmount that 0*x = 0. Avoids looking up non-existant exchange rate.

Mike Alexander mta at code.gnucash.org
Thu Dec 17 01:30:26 EST 2009


Author: mta
Date: 2009-12-17 01:30:26 -0500 (Thu, 17 Dec 2009)
New Revision: 18508
Trac: http://svn.gnucash.org/trac/changeset/18508

Modified:
   gnucash/trunk/src/engine/Split.c
Log:
Teach xaccSplitConvertAmount that 0*x = 0.  Avoids looking up non-existant exchange rate.


Modified: gnucash/trunk/src/engine/Split.c
===================================================================
--- gnucash/trunk/src/engine/Split.c	2009-12-17 06:25:45 UTC (rev 18507)
+++ gnucash/trunk/src/engine/Split.c	2009-12-17 06:30:26 UTC (rev 18508)
@@ -1084,8 +1084,13 @@
    * compute the conversion rate (based on amount/value), and then multiply
    * this times the split value.
    */
+  value = xaccSplitGetValue (split);
+  
+  if (gnc_numeric_zero_p (value)) {
+    return value;
+  }
+  
   convrate = xaccTransGetAccountConvRate(txn, account);
-  value = xaccSplitGetValue (split);
   return gnc_numeric_mul (value, convrate,
 			  gnc_commodity_get_fraction (to_commodity),
 			  GNC_RND_ROUND);



More information about the gnucash-changes mailing list