diff --git a/struct.go b/struct.go index 6694a53..8d8af66 100644 --- a/struct.go +++ b/struct.go @@ -181,9 +181,10 @@ func (b *structBuilder) Map() { if b == nil { return } + if v := b.val; v.Kind() == reflect.Ptr { if v.IsNil() { - v.Set(reflect.Zero(v.Type().Elem()).Addr()) + v.Set(reflect.New(v.Type().Elem())) b.Flush() } b.map_ = reflect.Value{}