Skip to content

Commit

Permalink
Bug fix "Cannot read property 'end' of undefined" on babel-plugin-mak…
Browse files Browse the repository at this point in the history
…epot #21466 (#22394)

* bug fix #21466
  • Loading branch information
miya0001 authored Jun 12, 2020
1 parent 7bdf8d3 commit 8dca7e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/babel-plugin-makepot/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ function getExtractedComment( path, _originalNodeLine ) {

let comment;
forEach( node.leadingComments, ( commentNode ) => {
const { line } = commentNode.loc.end;
let line = 0;
if ( commentNode && commentNode.loc && commentNode.loc.end ) {
line = commentNode.loc.end.line;
}

if ( line < _originalNodeLine - 1 || line > _originalNodeLine ) {
return;
}
Expand Down

0 comments on commit 8dca7e9

Please sign in to comment.