prettyprint: fix index out of range error (#2131)

api.(*Variable).recursiveKind should not assume that a pointer is
always fully loaded.

Fixes #2130
This commit is contained in:
Alessandro Arzilli 2020-08-18 02:19:08 +02:00 committed by GitHub
parent 9c83866c72
commit 930fa3b734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -291,6 +291,9 @@ func (v *Variable) recursiveKind() (reflect.Kind, bool) {
kind = v.Kind
if kind == reflect.Ptr {
hasptr = true
if len(v.Children) == 0 {
return kind, hasptr
}
v = &(v.Children[0])
} else {
break