From 3e54b4207ae3ec44ed626e15be3723aafbada02a Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 4 Jun 2024 12:57:04 +0000 Subject: [PATCH] fixes --- src/rbtree.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rbtree.cpp b/src/rbtree.cpp index f01e31db51de94..a22133e54f23ab 100644 --- a/src/rbtree.cpp +++ b/src/rbtree.cpp @@ -70,10 +70,10 @@ class Tree template void fix_insert(Node* z) { - while (z != m_roots[I] && !z->m_positions[I].m_black) { + while (z != m_roots[I] && !z->m_positions[I].m_parent->m_positions[I].m_black) { if (z->m_positions[I].m_parent == z->m_positions[I].m_parent->m_positions[I].m_parent->m_positions[I].m_left) { Node* y = z->m_positions[I].m_parent->m_positions[I].m_parent->m_positions[I].m_right; - if (y != nullptr && !z->m_positions[I].m_black) { + if (y != nullptr && !y->m_positions[I].m_black) { z->m_positions[I].m_parent->m_positions[I].m_black = true; y->m_positions[I].m_black = true; z->m_positions[I].m_parent->m_positions[I].m_parent->m_positions[I].m_black = false;