summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2007-01-11 09:39:35 +0000
committerSimon Tatham <anakin@pobox.com>2007-01-11 09:39:35 +0000
commit2641476245d6cb1e9e85d37c6c539741aff2800d (patch)
treea8e3d0da04aadc94deaea186fdbe65cfa0aaa815
parent9cdf53b85c483f6e6f2ca87a54d563854640ae91 (diff)
downloadhalibut-2641476245d6cb1e9e85d37c6c539741aff2800d.zip
halibut-2641476245d6cb1e9e85d37c6c539741aff2800d.tar.gz
halibut-2641476245d6cb1e9e85d37c6c539741aff2800d.tar.bz2
halibut-2641476245d6cb1e9e85d37c6c539741aff2800d.tar.xz
Duplicate fix of Kevin Lyles's bug from r7092.
[originally from svn r7093] [r7092 == c06e371f55b97576421588d21d809c02c637584b in puzzles repository]
-rw-r--r--tree234.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tree234.c b/tree234.c
index 06738cb..26d188e 100644
--- a/tree234.c
+++ b/tree234.c
@@ -1440,8 +1440,11 @@ tree234 *copytree234(tree234 *t, copyfn234 copyfn, void *copyfnstate) {
tree234 *t2;
t2 = newtree234(t->cmp);
- t2->root = copynode234(t->root, copyfn, copyfnstate);
- t2->root->parent = NULL;
+ if (t->root) {
+ t2->root = copynode234(t->root, copyfn, copyfnstate);
+ t2->root->parent = NULL;
+ } else
+ t2->root = NULL;
return t2;
}
@@ -2122,11 +2125,12 @@ int main(void) {
tree = newtree234(mycmp);
cmp = mycmp;
arraylen = 0;
- for (i = 0; i < 16; i++) {
- addtest(strings[i]);
+ for (i = 0; i < 17; i++) {
tree2 = copytree234(tree, NULL, NULL);
splittest(tree2, array, arraylen);
freetree234(tree2);
+ if (i < 16)
+ addtest(strings[i]);
}
freetree234(tree);