Path error. Cannot read property of undefined #94

Closed
dgarciaacosta opened this Issue Jun 10, 2011 · 1 comment

Comments

Projects
None yet
2 participants

Handlebar fails if object doesn't exists in object.property paths

Template

{{#books}}
  {{title}}
  {{author.name}}
{{#books}}

JSON

{
  "books":[
    {
      "title":"The origin of species",
      "author":{
        "name":"Charles Darwin"
      }
    },
    {
      "title":"Lazarillo de Tormes"
    }
  ]
}

Test

var json = {"books":[{"title":"The origin of species","author":{"name":"Charles Darwin"}},{"title":"Lazarillo de Tormes"}]}; var hb = Handlebars.compile("{{#books}}{{title}}{{author.name}}{{/books}}"); hb(json);

BugTrace
JavaScriptCompiler.createFunction in handlebars.1.0.0.beta.3.js:1189

Contributor

commondream commented Sep 2, 2011

This should be fixed with the latest commit. Thanks for reporting that issue!

@commondream commondream closed this Sep 2, 2011

@dmnd dmnd referenced this issue Dec 27, 2011

Merged

Npm update #157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment