From: Gustavo Niemeyer Date: Mon, 15 Aug 2011 17:14:15 +0000 (-0300) Subject: reflect: panic on Invalid Interface call X-Git-Tag: weekly.2011-08-17~48 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a2bb0159d6442ce03f5a1f2bbc636a2f526e004a;p=gostls13.git 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 --- 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") }