diff --git a/src/reflect/value.go b/src/reflect/value.go index 3f879e29..3e61c44a 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -568,6 +568,9 @@ func (v Value) Elem() Value { // Field returns the value of the i'th field of this struct. func (v Value) Field(i int) Value { + if v.Kind() != Struct { + panic(&ValueError{Method: "Field", Kind: v.Kind()}) + } structField := v.typecode.rawField(i) flags := v.flags if structField.PkgPath != "" {