Skip to content

Commit

Permalink
this error needs to be handled otherwise we can put string value in b…
Browse files Browse the repository at this point in the history
…etween [] while fetching array elements
  • Loading branch information
soniabhishek committed Mar 31, 2017
1 parent 016ea00 commit 9a634d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,10 @@ func searchKeys(data []byte, keys ...string) int {
case '[':
// If we want to get array element by index
if keyLevel == level && keys[level][0] == '[' {
aIdx, _ := strconv.Atoi(keys[level][1 : len(keys[level])-1])

aIdx, err := strconv.Atoi(keys[level][1 : len(keys[level])-1])
if err != nil {
return -1
}
var curIdx int
var valueFound []byte
var valueOffset int
Expand Down

0 comments on commit 9a634d7

Please sign in to comment.