diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2011-08-15 14:14:15 -0300 |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2011-08-15 14:14:15 -0300 |
commit | a2bb0159d6442ce03f5a1f2bbc636a2f526e004a (patch) | |
tree | a31f50a7b7b61b532c31ebd3ee3f219ef5eaa742 | |
parent | 241a262fe592911b8be3d44694429103e4ff86e4 (diff) | |
download | go-a2bb0159d6442ce03f5a1f2bbc636a2f526e004a.tar.gz go-a2bb0159d6442ce03f5a1f2bbc636a2f526e004a.zip |
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
-rw-r--r-- | src/pkg/reflect/value.go | 3 |
1 files changed, 3 insertions, 0 deletions
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") } |