]> Cypherpunks repositories - gostls13.git/commit
text/template: protect against explicit nil in field chains
authorRob Pike <r@golang.org>
Tue, 13 Jan 2015 22:13:42 +0000 (09:13 +1100)
committerRob Pike <r@golang.org>
Mon, 16 Mar 2015 22:35:49 +0000 (22:35 +0000)
commit5764befa5ace6e2dff623a79ba5a098d36fd1a86
tree5d293f8b0490f816f71191dc9a8c97c35910d854
parent10a98dd6d912783fbd9226615d16b526f2c9dd6c
text/template: protect against explicit nil in field chains

An explicit nil in an expression like nil.Foo caused a panic
because the evaluator attempted to reflect on the nil.
A typeless nil like this cannot be used to do anything, so
just error out.

Fixes #9426

Change-Id: Icd2c9c7533dda742748bf161eced163991a12f54
Reviewed-on: https://go-review.googlesource.com/7643
Reviewed-by: David Symonds <dsymonds@golang.org>
src/text/template/exec.go
src/text/template/exec_test.go