Skip to content

Commit e80118a

Browse files
committed
Readd nil ptr fix
1 parent 4ecc8ee commit e80118a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

decoder.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ func (d *decoder) decodeMap(name string, node ast.Node, result reflect.Value) er
397397
}
398398

399399
func (d *decoder) decodePtr(name string, node ast.Node, result reflect.Value) error {
400+
// if pointer is not nil, decode into existing value
401+
if !result.IsNil() {
402+
return d.decode(name, node, result.Elem())
403+
}
404+
400405
// Create an element of the concrete (non pointer) type and decode
401406
// into that. Then set the value of the pointer to this type.
402407
resultType := result.Type()

0 commit comments

Comments
 (0)