Make parse error handler more robust

This is necessary to get useful error messages in cases where root has not been constructed successfully.
This commit is contained in:
Adrian Lang
2012-01-29 13:04:43 +01:00
parent 557177c76d
commit a8802fc8ac

View File

@@ -19,7 +19,7 @@ var less = {
if (callback) {
parser.parse(input, function (e, root) {
callback(e, root.toCSS(options));
callback(e, root && root.toCSS && root.toCSS(options));
});
} else {
ee = new(require('events').EventEmitter);