Skip to content

Commit

Permalink
tree: simplify maxParams check for catch-all and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
julienschmidt committed Sep 25, 2019
1 parent df4f025 commit ccb1657
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@ func (n *node) insertChild(numParams uint8, path, fullPath string, handle Handle
nType: catchAll,
maxParams: 1,
}
if child.maxParams > n.maxParams {
n.maxParams = child.maxParams
// update maxParams of the parent node
if n.maxParams < 1 {
n.maxParams = 1
}
n.children = []*node{child}
n.indices = string(path[i])
Expand Down

0 comments on commit ccb1657

Please sign in to comment.