Skip to content

Commit

Permalink
fix issue mozilla#1029; might be a better approach but this seems to …
Browse files Browse the repository at this point in the history
…pass
  • Loading branch information
devoidfury committed Jan 8, 2018
1 parent 0509111 commit b56bbad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/environment.js
Expand Up @@ -152,12 +152,12 @@ var Environment = Obj.extend({
}
return this.filters[name];
},

addTest: function(name, func) {
this.tests[name] = func;
return this;
},

getTest: function(name) {
if(!this.tests[name]) {
throw new Error('test not found: ' + name);
Expand Down Expand Up @@ -495,15 +495,21 @@ Template = Obj.extend({
var frame = parentFrame ? parentFrame.push(true) : new Frame();
frame.topLevel = true;
var syncResult = null;
var didError = false;

_this.rootRenderFunc(
_this.env,
context,
frame || new Frame(),
runtime,
function(err, res) {
if (didError) {
// prevent multiple calls to cb
return;
}
if(err) {
err = lib.prettifyError(_this.path, _this.env.opts.dev, err);
didError = true;
}

if(cb) {
Expand Down

0 comments on commit b56bbad

Please sign in to comment.