aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Niemeyer <gustavo@niemeyer.net>2011-08-15 14:14:15 -0300
committerGustavo Niemeyer <gustavo@niemeyer.net>2011-08-15 14:14:15 -0300
commita2bb0159d6442ce03f5a1f2bbc636a2f526e004a (patch)
treea31f50a7b7b61b532c31ebd3ee3f219ef5eaa742
parent241a262fe592911b8be3d44694429103e4ff86e4 (diff)
downloadgo-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.go3
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")
}