Skip to content

Commit

Permalink
fix: prune boostMatchTree if child is pruned (#732)
Browse files Browse the repository at this point in the history
The old behavior led to panics in NextDoc if the child was pruned.
  • Loading branch information
stefanhengl authored Jan 29, 2024
1 parent 340c5f8 commit dbe1d4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions matchtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,12 @@ func pruneMatchTree(mt matchTree) (matchTree, error) {
mt.child, err = pruneMatchTree(mt.child)
case *boostMatchTree:
mt.child, err = pruneMatchTree(mt.child)
if err != nil {
return nil, err
}
if mt.child == nil {
return nil, nil
}
case *andLineMatchTree:
child, err := pruneMatchTree(&mt.andMatchTree)
if err != nil {
Expand Down

0 comments on commit dbe1d4b

Please sign in to comment.