Skip to content

Commit

Permalink
Check length of arg array
Browse files Browse the repository at this point in the history
  • Loading branch information
hmgle committed Feb 25, 2017
1 parent 018bd2d commit 22027ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions named.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ func bindArray(bindType int, query string, arg interface{}, m *reflectx.Mapper)
}
arrayValue := reflect.ValueOf(arg)
arrayLen := arrayValue.Len()
if arrayLen == 0 {
return "", []interface{}{}, fmt.Errorf("length of array is 0: %#v", arg)
}
var arglist []interface{}
for i := 0; i < arrayLen; i++ {
elemArglist, err := bindArgs(names, arrayValue.Index(i).Interface(), m)
Expand Down

0 comments on commit 22027ea

Please sign in to comment.