From a2bb0159d6442ce03f5a1f2bbc636a2f526e004a Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Mon, 15 Aug 2011 14:14:15 -0300 Subject: [PATCH] reflect: panic on Invalid Interface call This was initially pushed as part of CL 4876046, found when logic in exp/template was using the method on an Invalid value. R=rsc CC=golang-dev https://golang.org/cl/4890043 --- src/pkg/reflect/value.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pkg/reflect/value.go b/src/pkg/reflect/value.go index 82985c5751..87d12bb0b7 100644 --- a/src/pkg/reflect/value.go +++ b/src/pkg/reflect/value.go @@ -860,6 +860,9 @@ func (v Value) Interface() interface{} { } func (iv internalValue) Interface() interface{} { + if iv.kind == 0 { + panic(&ValueError{"reflect.Value.Interface", iv.kind}) + } if iv.method { panic("reflect.Value.Interface: cannot create interface value for method with bound receiver") } -- 2.50.0