summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-10-09 05:17:53 +0000
committerTavian Barnes <tavianator@gmail.com>2009-10-09 05:17:53 +0000
commita9c5e1caf089c8b6fd77beb4452fbb6049fc8d9e (patch)
tree7bd21ed38934977e1d0cad4c7492a1f2fb36ed20 /libdimension
parentc7d53c4e6ac03d04ecc88d36bb426d6756cf5994 (diff)
downloaddimension-a9c5e1caf089c8b6fd77beb4452fbb6049fc8d9e.tar.xz
kD splay tree fixes.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/kD_splay_tree.c12
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;
}