Fix issue in tree_remove when it is root node (part 1)

This commit is contained in:
Patrick Pelissier committed 2023-04-18 22:56:56 +02:00
1 parent 693b09387f
commit 8639fdbd98
2 files changed
+32 -2

No files matched your search

+4
View File
@@ -759,6 +759,8 @@ typedef int32_t m_tr33_index_t;
if (parent >= 0 && it.tree->tab[parent].child == it.index) { \
M_ASSERT(left == M_TR33_NO_NODE); \
it.tree->tab[parent].child = right; \
} else if (parent == M_TR33_ROOT_NODE) { \
it.tree->root_index = right; \
} \
} else { \
/* Merge the child with the current siblings */ \
@@ -782,6 +784,8 @@ typedef int32_t m_tr33_index_t;
if (parent >= 0 && it.tree->tab[parent].child == it.index) { \
M_ASSERT(left == M_TR33_NO_NODE); \
it.tree->tab[parent].child = child; \
} else if (parent == M_TR33_ROOT_NODE) { \
it.tree->root_index = child; \
} \
} \
/* Free the node to the allocator */ \