r17702 - gnucash/branches/2.2/src/import-export - [r17663] Bug #436920: Fix crash on loading OFX data for a commodity that exists without cusip field

Christian Stimming cstim at cvs.gnucash.org
Sat Nov 15 16:41:57 EST 2008


Author: cstim
Date: 2008-11-15 16:41:56 -0500 (Sat, 15 Nov 2008)
New Revision: 17702
Trac: http://svn.gnucash.org/trac/changeset/17702

Modified:
   gnucash/branches/2.2/src/import-export/import-commodity-matcher.c
Log:
[r17663] Bug #436920: Fix crash on loading OFX data for a commodity that exists without cusip field

Original patch included also the fix of r16884, which was applied earlier already.

Patch by David Osguthorpe.

Modified: gnucash/branches/2.2/src/import-export/import-commodity-matcher.c
===================================================================
--- gnucash/branches/2.2/src/import-export/import-commodity-matcher.c	2008-11-15 21:41:48 UTC (rev 17701)
+++ gnucash/branches/2.2/src/import-export/import-commodity-matcher.c	2008-11-15 21:41:56 UTC (rev 17702)
@@ -121,6 +121,12 @@
 						default_mnemonic);
       
     }
+  /* There seems to be a problem here - if the matched commodity does not
+     have a cusip defined (gnc_commodity_get_cusip returns NULL) then
+     it does not get overwritten - which is not consistent with the
+     message - so Im adding it to do this.  Looks like this is all
+     that was needed to fix the cash value used as stock units problem
+     for pre-defined commodities which didnt have the cusip defined! */
   if (retval != NULL&&
       gnc_commodity_get_cusip(retval)!=NULL &&
       cusip != NULL &&
@@ -128,6 +134,10 @@
     {
       gnc_commodity_set_cusip(retval, cusip);
     }
+  else if (gnc_commodity_get_cusip(retval)==NULL && cusip != NULL)
+    {
+      gnc_commodity_set_cusip(retval, cusip);
+    }
   return retval;
 };
 /**@}*/



More information about the gnucash-changes mailing list