error checking for insert-split

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@799 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-04-12 19:05:25 +00:00
parent df53298e0b
commit 9159e65a9d

View File

@ -535,11 +535,20 @@ xaccTransAppendSplit (Transaction *trans, Split *split)
{
int i, num;
Split **oldarray;
Transaction *oldtrans;
if (!trans) return;
if (!split) return;
/* first, make sure that the split isn't already inserted
* elsewhere. If so, then remove it. */
oldtrans = split->parent;
if (oldtrans) {
xaccTransRemoveSplit (oldtrans, split);
xaccTransRebalance (oldtrans);
}
/* first, insert the split into the array */
/* now, insert the split into the array */
split->parent = trans;
num = xaccCountSplits (trans->splits);