From 930fa3b7345f8b17f8918206c11d2b86ae6ca549 Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Tue, 18 Aug 2020 02:19:08 +0200 Subject: [PATCH] prettyprint: fix index out of range error (#2131) api.(*Variable).recursiveKind should not assume that a pointer is always fully loaded. Fixes #2130 --- service/api/prettyprint.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/api/prettyprint.go b/service/api/prettyprint.go index 84b8e595..45571def 100644 --- a/service/api/prettyprint.go +++ b/service/api/prettyprint.go @@ -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