1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00

Index out of bound error #103

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-06-20 18:56:51 -07:00
parent dee0dddd67
commit e13719cf16

View File

@ -51,7 +51,7 @@ func (c *Context) Socket() *websocket.Conn {
// P returns path parameter by index.
func (c *Context) P(i int) (value string) {
l := len(c.pnames)
if i <= l {
if i < l {
value = c.pvalues[i]
}
return
@ -61,7 +61,7 @@ func (c *Context) P(i int) (value string) {
func (c *Context) Param(name string) (value string) {
l := len(c.pnames)
for i, n := range c.pnames {
if n == name && i <= l {
if n == name && i < l {
value = c.pvalues[i]
break
}