r19380 - gnucash/trunk/src/engine - FIx bug 596124: don't crash if someone adds a split to a capital gains transaction
Mike Alexander
mta at code.gnucash.org
Tue Jul 27 23:48:08 EDT 2010
Author: mta
Date: 2010-07-27 23:48:07 -0400 (Tue, 27 Jul 2010)
New Revision: 19380
Trac: http://svn.gnucash.org/trac/changeset/19380
Modified:
gnucash/trunk/src/engine/cap-gains.c
Log:
FIx bug 596124: don't crash if someone adds a split to a capital gains transaction
created by the lot scrubber.
Modified: gnucash/trunk/src/engine/cap-gains.c
===================================================================
--- gnucash/trunk/src/engine/cap-gains.c 2010-07-27 22:46:17 UTC (rev 19379)
+++ gnucash/trunk/src/engine/cap-gains.c 2010-07-28 03:48:07 UTC (rev 19380)
@@ -974,11 +974,18 @@
{
trans = lot_split->parent;
gain_split = xaccSplitGetOtherSplit (lot_split);
+
+ /* If the gains transaction has been edited so that it no longer has
+ just two splits, ignore it and assume it's still correct. */
+ if (!gain_split)
+ {
+ new_gain_split = FALSE;
+ }
/* If the gain is already recorded corectly do nothing. This is
* more than just an optimization since this may be called during
* gnc_book_partition_txn and depending on the order in which things
* happen some splits may be in the wrong book at that time. */
- if (split->gains_split == lot_split &&
+ else if (split->gains_split == lot_split &&
lot_split->gains_split == split &&
gain_split->gains_split == split &&
gnc_numeric_equal (xaccSplitGetValue (lot_split), value) &&
More information about the gnucash-changes
mailing list