types: rbtree - add panic check

This commit is contained in:
c9s 2022-08-07 11:44:50 +08:00
parent 4e4ffe83e5
commit 2dff1e72da
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -314,6 +314,9 @@ func (tree *RBTree) RotateRight(y *RBNode) {
y.left = x.right
if !x.right.isNil() {
if x.right == nil {
panic(fmt.Errorf("x.right is nil: node = %+v, left = %+v, right = %+v, parent = %+v", x, x.left, x.right, x.parent))
}
x.right.parent = y
}