From ccb1657ac6d5d3c7e98861d977faaf2a0f9507b7 Mon Sep 17 00:00:00 2001 From: Julien Schmidt Date: Wed, 25 Sep 2019 22:20:06 +0200 Subject: [PATCH] tree: simplify maxParams check for catch-all and add comment --- tree.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tree.go b/tree.go index e239bbff..b248ca20 100644 --- a/tree.go +++ b/tree.go @@ -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])