mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 798958 - gncScrubLotLinks will infinite loop in some conditions
The conditions being containing a split from a voided transaction. Instead of trying to destroy zero-value splits (doomed to fail in that instance and generally rude otherwise) just remove them from the lot list.
This commit is contained in:
parent
c5181180ad
commit
cbe765c6d9
@ -214,13 +214,21 @@ scrub_start:
|
|||||||
if (xaccTransGetTxnType (ll_txn) == TXN_TYPE_INVOICE)
|
if (xaccTransGetTxnType (ll_txn) == TXN_TYPE_INVOICE)
|
||||||
continue; // next scrub lot split
|
continue; // next scrub lot split
|
||||||
|
|
||||||
// Empty splits can be removed immediately
|
// Empty splits can be immediately removed from the list.
|
||||||
if (gnc_numeric_zero_p (xaccSplitGetValue (sl_split)) ||
|
if (gnc_numeric_zero_p (xaccSplitGetValue (sl_split)))
|
||||||
gnc_numeric_zero_p(xaccSplitGetValue (sl_split)))
|
|
||||||
{
|
{
|
||||||
xaccSplitDestroy (sl_split);
|
GList *tmp_iter = sls_iter->prev;
|
||||||
modified = TRUE;
|
PINFO("Removing 0-value split from the lot.");
|
||||||
goto scrub_start;
|
|
||||||
|
if (xaccTransGetReadOnly(xaccSplitGetParent(sl_split)))
|
||||||
|
gnc_lot_remove_split (scrub_lot, sl_split);
|
||||||
|
else
|
||||||
|
xaccSplitDestroy (sl_split);
|
||||||
|
|
||||||
|
sls_iter = tmp_iter;
|
||||||
|
if (!sls_iter)
|
||||||
|
goto scrub_start; // Otherwise sls_iter->next will crash
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate over all splits in the lot link transaction
|
// Iterate over all splits in the lot link transaction
|
||||||
|
Loading…
Reference in New Issue
Block a user