Skip to content

Commit

Permalink
fix: panic trying to get length of a ptr value (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt authored and fsamin committed May 8, 2019
1 parent 1c5c776 commit ac6679a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ func (e *Encoder) fDumpArray(w map[string]interface{}, i interface{}, roots []st
}

v := reflect.ValueOf(i)
if v.Kind() == reflect.Ptr {
v = v.Elem()
}

if e.ExtraFields.Len {
nodeLen := append(roots, "__Len__")
Expand Down

0 comments on commit ac6679a

Please sign in to comment.