From a9c5e1caf089c8b6fd77beb4452fbb6049fc8d9e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 9 Oct 2009 05:17:53 +0000 Subject: kD splay tree fixes. --- libdimension/kD_splay_tree.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libdimension') 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; } -- cgit v1.2.3