Merge pull request #592 from fourplusone/fix_crash_minify_dir

fix crash if getFileCompressed fails (i.e. if /static/js is called)
This commit is contained in:
John McLear 2012-04-03 12:08:03 -07:00
commit 49593a1c8e
1 changed files with 4 additions and 1 deletions

View File

@ -131,7 +131,10 @@ exports.minify = function(req, res, next)
res.end();
} else if (req.method == 'GET') {
getFileCompressed(filename, contentType, function (error, content) {
if(ERR(error)) return;
if(ERR(error, function(){
res.writeHead(500, {});
res.end();
})) return;
res.header("Content-Type", contentType);
res.writeHead(200, {});
res.write(content);