FAQ

Search Discussions

  • R at Oct 6, 2012 at 10:27 pm
    *** Submitted as
    http://code.google.com/p/go/source/detail?r=311d011a9e0b ***

    text/template: fix nil crash on Templates
    Fixes issue 3872.

    R=golang-dev, rsc
    CC=golang-dev
    http://codereview.appspot.com/6612060


    http://codereview.appspot.com/6612060/
  • R at Oct 6, 2012 at 10:29 pm
    Reviewers: golang-dev_googlegroups.com,

    Message:
    Hello golang-dev@googlegroups.com,

    I'd like you to review this change to
    https://code.google.com/p/go/


    Description:
    text/template: fix nil crash on Templates
    Fixes issue 3872.

    Please review this at http://codereview.appspot.com/6612060/

    Affected files:
    M src/pkg/text/template/exec_test.go
    M src/pkg/text/template/template.go


    Index: src/pkg/text/template/exec_test.go
    ===================================================================
    --- a/src/pkg/text/template/exec_test.go
    +++ b/src/pkg/text/template/exec_test.go
    @@ -811,3 +811,9 @@
    t.Errorf("expected %q got %q", expect, result)
    }
    }
    +
    +func TestExecuteOnNewTemplate(t *testing.T) {
    + // This is issue 3872.
    + _ = New("Name").Templates()
    + New("Name").Delims("<", ">")
    +}
    Index: src/pkg/text/template/template.go
    ===================================================================
    --- a/src/pkg/text/template/template.go
    +++ b/src/pkg/text/template/template.go
    @@ -117,6 +117,9 @@
    // Templates returns a slice of the templates associated with t, including
    t
    // itself.
    func (t *Template) Templates() []*Template {
    + if t.common == nil {
    + return nil
    + }
    // Return a slice so we don't expose the map.
    m := make([]*Template, 0, len(t.tmpl))
    for _, v := range t.tmpl {

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 6, '12 at 10:23p
activeOct 6, '12 at 10:29p
posts3
users2
websitegolang.org

2 users in discussion

R: 2 posts Russ Cox: 1 post

People

Translate

site design / logo © 2022 Grokbase