diff options
-rw-r--r-- | src/rbtree.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rbtree.c b/src/rbtree.c index 9db0641c..afbdca64 100644 --- a/src/rbtree.c +++ b/src/rbtree.c @@ -242,13 +242,13 @@ void rb_erase(struct rb_node *node, struct rb_root *root) parent = rb_parent(node); color = rb_color(node); - if (child) - rb_set_parent(child, parent); if (parent == old) { - parent->rb_right = child; parent = node; - } else + } else { + if (child) + rb_set_parent(child, parent); parent->rb_left = child; + } node->rb_parent_color = old->rb_parent_color; node->rb_right = old->rb_right; |