1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:27:58 -07:00

do not crash on nil data value

R=r
DELTA=3  (3 added, 0 deleted, 0 changed)
OCL=34606
CL=34609
This commit is contained in:
Russ Cox 2009-09-14 16:46:48 -07:00
parent c5a441ac70
commit b198b994a1

View File

@ -575,6 +575,9 @@ func (st *state) findVar(s string) reflect.Value {
for i := 0; i < len(elems); i++ {
// Look up field; data must be a struct.
data = reflect.Indirect(data);
if data == nil {
return nil
}
typ, ok := data.Type().(*reflect.StructType);
if !ok {
return nil