mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
add check the values array length, avoid panic: index out of range
This commit is contained in:
parent
a8e263c9e4
commit
7c1502bf04
|
@ -1813,8 +1813,11 @@ func (ctx *Context) PostValueDefault(name string, def string) string {
|
|||
if err != nil {
|
||||
return def // it returns "def" even if it's empty here.
|
||||
}
|
||||
|
||||
if len(values) > 0 {
|
||||
return values[len(values)-1]
|
||||
}
|
||||
|
||||
return def
|
||||
}
|
||||
|
||||
// PostValue returns the last parsed form data from POST, PATCH,
|
||||
|
|
Loading…
Reference in New Issue
Block a user