gnucash maint: Fix xaccSplitGetOtherSplit which was broken by 028bf9826, don't count splits that aren't really in the transaction.

Mike Alexander mta at code.gnucash.org
Mon Sep 6 03:10:37 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/068a5d2f (commit)
	from  https://github.com/Gnucash/gnucash/commit/4afe5d83 (commit)



commit 068a5d2fa8f2a9658b4b5ffb0a8821adf58d09f3
Author: Mike Alexander <mta at umich.edu>
Date:   Mon Sep 6 02:45:37 2021 -0400

    Fix xaccSplitGetOtherSplit which was broken by 028bf9826, don't
    count splits that aren't really in the transaction.
    
    The rewrite left out one test.  This was most obvious in the dummy
    transaction used to enter a new transaction into an account.
    xaccSplitGetOtherSplit never returned an "other split" for this
    transaction.  It turns out the old code was broken too, but
    it worked for this case by coincidence.

diff --git a/libgnucash/engine/Split.c b/libgnucash/engine/Split.c
index d771e1f8b..31ede94c6 100644
--- a/libgnucash/engine/Split.c
+++ b/libgnucash/engine/Split.c
@@ -2107,6 +2107,7 @@ xaccSplitGetOtherSplit (const Split *split)
     {
         Split *s = n->data;
         if ((s == split) ||
+            (!xaccTransStillHasSplit(trans, s)) ||
             (xaccAccountGetType (xaccSplitGetAccount (s)) == ACCT_TYPE_TRADING) ||
             (qof_instance_has_slot (QOF_INSTANCE (s), "lot-split")))
             continue;



Summary of changes:
 libgnucash/engine/Split.c | 1 +
 1 file changed, 1 insertion(+)



More information about the gnucash-changes mailing list