Commit 755a9913 authored by Chris Müller's avatar Chris Müller

lib: fixing segfault when removing root node from a 2 node graph.

parent be7fd6ad
...@@ -343,9 +343,9 @@ rb_remove_external_node(struct RBNode* node) ...@@ -343,9 +343,9 @@ rb_remove_external_node(struct RBNode* node)
struct RBNode* child = (node->left == 0) ? node->right : node->left; struct RBNode* child = (node->left == 0) ? node->right : node->left;
if(RB_PARENT(node)->left == node) if(RB_PARENT(node) != 0 && RB_PARENT(node)->left == node)
RB_PARENT(node)->left = child; RB_PARENT(node)->left = child;
else else if(RB_PARENT(node) != 0)
RB_PARENT(node)->right = child; RB_PARENT(node)->right = child;
if(child != 0) if(child != 0)
...@@ -360,7 +360,7 @@ rb_tree_remove(struct RBTree* tree, const_pointer key) ...@@ -360,7 +360,7 @@ rb_tree_remove(struct RBTree* tree, const_pointer key)
{ {
assert(tree != 0 && key != 0); assert(tree != 0 && key != 0);
struct RBNode* node = tree->root; struct RBNode* node = 0;
struct RBNode* current_node = 0; struct RBNode* current_node = 0;
struct RBNode* data_node = 0; struct RBNode* data_node = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment