fix(tree): Keep panic infos consistent when wildcard type build faild (#4077)

This commit is contained in:
Xinyu Kuo
2024-10-26 08:28:59 +08:00
committed by GitHub
parent 9d11234efe
commit ea53388e6e
3 changed files with 27 additions and 2 deletions
+1 -1
View File
@@ -369,7 +369,7 @@ func (n *node) insertChild(path string, fullPath string, handlers HandlersChain)
// currently fixed width 1 for '/'
i--
if path[i] != '/' {
if i < 0 || path[i] != '/' {
panic("no / before catch-all in path '" + fullPath + "'")
}