diff --git a/context.go b/context.go index da035a4c..71bc3e4f 100644 --- a/context.go +++ b/context.go @@ -237,7 +237,7 @@ func (c *context) SetPath(p string) { func (c *context) Param(name string) string { for i, n := range c.pnames { - if i < len(c.pnames) { + if i < len(c.pvalues) { if n == name { return c.pvalues[i] } diff --git a/router.go b/router.go index b53edb5a..b06bb1d7 100644 --- a/router.go +++ b/router.go @@ -177,8 +177,8 @@ func (r *Router) insert(method, path string, h HandlerFunc, t kind, ppath string } for i, n := range pnames { // Param name aliases - if !strings.Contains(n, pnames[i]) { - cn.pnames[i] += "," + pnames[i] + if i < len(cn.pnames) && !strings.Contains(cn.pnames[i], n) { + cn.pnames[i] += "," + n } } }