mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +00:00
rbt: fix preorder
This commit is contained in:
parent
7805dcd72e
commit
5d8f7b3ea6
|
@ -389,7 +389,7 @@ func (tree *RBTree) Preorder(cb func(n *RBNode)) {
|
|||
}
|
||||
|
||||
func (tree *RBTree) PreorderOf(current *RBNode, cb func(n *RBNode)) {
|
||||
if current != tree.neel {
|
||||
if current != tree.neel && current != nil {
|
||||
cb(current)
|
||||
tree.PreorderOf(current.Left, cb)
|
||||
tree.PreorderOf(current.Right, cb)
|
||||
|
|
Loading…
Reference in New Issue
Block a user