check for loc value on comments before attempting to adjust it

This commit is contained in:
Sebastian McKenzie 2015-06-07 23:37:47 +01:00
parent 66599c3779
commit a298075949

View File

@ -344,7 +344,7 @@ class CodeGenerator {
//
if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) {
var offset = comment.loc.start.column;
var offset = comment.loc && comment.loc.start.column;
if (offset) {
var newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
val = val.replace(newlineRegex, "\n");