diff --git a/lib/less/tree/debug-info.js b/lib/less/tree/debug-info.js
index <HASH>..<HASH> 100644
--- a/lib/less/tree/debug-info.js
+++ b/lib/less/tree/debug-info.js
@@ -16,9 +16,10 @@ const debugInfo = (context, ctx, lineSeparator) => {
     return result;
 };
 
-debugInfo.asComment = ctx => `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n`;
+debugInfo.asComment = ctx => ctx.debugInfo ? `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n` : '';
 
 debugInfo.asMediaQuery = ctx => {
+    if (!ctx.debugInfo) { return ''; }
     let filenameWithProtocol = ctx.debugInfo.fileName;
     if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) {
         filenameWithProtocol = `file://${filenameWithProtocol}`;
issue#<I> ignore missing debugInfo (#<I>)