diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-10-09 05:17:53 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-10-09 05:17:53 +0000 |
commit | a9c5e1caf089c8b6fd77beb4452fbb6049fc8d9e (patch) | |
tree | 7bd21ed38934977e1d0cad4c7492a1f2fb36ed20 /libdimension/kD_splay_tree.c | |
parent | c7d53c4e6ac03d04ecc88d36bb426d6756cf5994 (diff) | |
download | dimension-a9c5e1caf089c8b6fd77beb4452fbb6049fc8d9e.tar.xz |
kD splay tree fixes.
Diffstat (limited to 'libdimension/kD_splay_tree.c')
-rw-r--r-- | libdimension/kD_splay_tree.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libdimension/kD_splay_tree.c b/libdimension/kD_splay_tree.c index 9243dbc..1a14e48 100644 --- a/libdimension/kD_splay_tree.c +++ b/libdimension/kD_splay_tree.c @@ -51,10 +51,14 @@ dmnsn_kD_splay_node *dmnsn_kD_splay_copy(dmnsn_kD_splay_node *root) if (root) { node = dmnsn_new_kD_splay_node(); *node = *root; - node->contains = dmnsn_kD_splay_copy(node->contains); - node->container = dmnsn_kD_splay_copy(node->container); - node->contains->parent = node; - node->container->parent = node; + if (node->contains) { + node->contains = dmnsn_kD_splay_copy(node->contains); + node->contains->parent = node; + } + if (node->container) { + node->container = dmnsn_kD_splay_copy(node->container); + node->container->parent = node; + } } return node; } |