Browse Source

Fixed a bug

Thomas Johnson 5 months ago
parent
commit
2046529ee6
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      tree_alloc.c

+ 1
- 1
tree_alloc.c View File

@@ -416,7 +416,7 @@ void remove_node(TreeAlloc **root_ptr, TreeAlloc *to_remove) {
416 416
 
417 417
 	if (replace && parent_of_replace == NULL) {
418 418
 		replace->color = COLOR_BLACK;
419
-	} else if (do_repair) {
419
+	} else if (parent_of_replace != NULL && do_repair) {
420 420
 		repair_after_remove(root_ptr, parent_of_replace, replace);
421 421
 	}
422 422
 #ifdef DEBUG

Loading…
Cancel
Save