Skip to content

Commit e3e5d38

Browse files
author
Tao Wen
committed
assert unmarshal with pointer
1 parent 86c58c9 commit e3e5d38

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

adapter.go

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ func CreateJsonAdapter(adapters ...TypeAdapter) JsonAdapter {
2525
t := reflect.ValueOf(out).Type()
2626
adapter := adapterMap[t]
2727
if adapter == nil {
28+
if t.Kind() != reflect.Ptr {
29+
return fmt.Errorf("unmarshal expect pointer, actual type is: %s", t)
30+
}
2831
return fmt.Errorf("unknown type: %s", t)
2932
}
3033
iter := ParseBytes(bytes)

0 commit comments

Comments
 (0)