From 9bd1b0a682f00de80b947f63c6e49f38767c16b7 Mon Sep 17 00:00:00 2001 From: mde Date: Tue, 6 Jan 2015 13:00:50 -0800 Subject: [PATCH] Fixes #5 crash on missing file --- lib/ejs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ejs.js b/lib/ejs.js index a09937f6..8a01bfd0 100644 --- a/lib/ejs.js +++ b/lib/ejs.js @@ -209,10 +209,11 @@ exports.renderFile = function () { } else { read(path, function (err, data) { - var tmpl = data.toString().trim(); + var tmpl; if (err) { return cb(err); } + tmpl = data.toString().trim(); if (opts.cache) { templateCache[path] = tmpl; }