Fix bugs relating to . and this.
First, I missed some reference checks when I stopped interning names. Fixed those. Second, when iterating over an array which contained null elements, the wrong thing was happening.
This commit is contained in:
@@ -856,8 +856,10 @@ public class Mustache {
|
||||
@Override public void execute (Template tmpl, Template.Context ctx, Writer out) {
|
||||
Object value = tmpl.getValueOrDefault(ctx, _name, _line);
|
||||
if (value == null) {
|
||||
throw new MustacheException.Context("No key, method or field with name '" + _name +
|
||||
"' on line " + _line, _name, _line);
|
||||
String msg = Template.isThisName(_name) ?
|
||||
"Resolved '.' to null (which is disallowed), on line " + _line :
|
||||
"No key, method or field with name '" + _name + "' on line " + _line;
|
||||
throw new MustacheException.Context(msg, _name, _line);
|
||||
}
|
||||
write(out, _escaper.escape(_formatter.format(value)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user