Skip to content

Commit c92086b

Browse files
committed
valid typ is a Pointer
1 parent 3504402 commit c92086b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libs/structs/structvar/structvar.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ func (sv *StructVar) Load(typ reflect.Type) error {
4646
if sv.valueCache != nil {
4747
return nil // Already loaded
4848
}
49+
if typ.Kind() != reflect.Pointer {
50+
return fmt.Errorf("expecting pointer, got %s", typ.Kind())
51+
}
4952
ptr := reflect.New(typ.Elem())
5053
if err := json.Unmarshal(sv.Value, ptr.Interface()); err != nil {
5154
return err

0 commit comments

Comments
 (0)