Skip to content

Commit

Permalink
Fix "Cannot read properties of undefined" regression (#15031)
Browse files Browse the repository at this point in the history
  • Loading branch information
farewell-zy committed Oct 10, 2022
1 parent c9ddd3c commit 2bbc722
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/babel-generator/src/printer.ts
Expand Up @@ -951,8 +951,8 @@ class Printer {
const comment = comments[i];

if (hasLoc && "loc" in comment && !this._printedComments.has(comment)) {
const commentStartLine = comment.loc.start.line;
const commentEndLine = comment.loc.end.line;
const commentStartLine = comment.loc?.start.line;
const commentEndLine = comment.loc?.end.line;
if (type === COMMENT_TYPE.LEADING) {
let offset = 0;
if (i === 0) {
Expand Down

0 comments on commit 2bbc722

Please sign in to comment.