Skip to content

Commit e13719c

Browse files
committed
Index out of bound error #103
Signed-off-by: Vishal Rana <[email protected]>
1 parent dee0ddd commit e13719c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (c *Context) Socket() *websocket.Conn {
5151
// P returns path parameter by index.
5252
func (c *Context) P(i int) (value string) {
5353
l := len(c.pnames)
54-
if i <= l {
54+
if i < l {
5555
value = c.pvalues[i]
5656
}
5757
return
@@ -61,7 +61,7 @@ func (c *Context) P(i int) (value string) {
6161
func (c *Context) Param(name string) (value string) {
6262
l := len(c.pnames)
6363
for i, n := range c.pnames {
64-
if n == name && i <= l {
64+
if n == name && i < l {
6565
value = c.pvalues[i]
6666
break
6767
}

0 commit comments

Comments
 (0)