FIx bug 596124: don't crash if someone adds a split to a capital gains transaction

created by the lot scrubber.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19380 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2010-07-28 03:48:07 +00:00
parent 7120209168
commit 4bc072690b

View File

@ -974,11 +974,18 @@ xaccSplitComputeCapGains(Split *split, Account *gain_acc)
{
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) &&