Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the "Cannot read property 'type' of undefined" bug. #1005

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sergemarkin
Copy link

In my project I got an error while processing one of the files:

...
  originalError: [Error: Parse error using esprima for file: /opt/app/src/app/vendor/istream-widget/istream-widget.js
  TypeError: Cannot read property 'type' of undefined
...

I investigated the problem and got to the line with if statement where the exp.type expression is compared to the string literal 'ExpressionStatement'. In some cases variable exp is undefined. I added a simple check for variable existence (truthiness) as an additional condition to the if statement.

A similar comparison with 'AssignmentExpression' literal is done originally in another fragment of code but in that case, proper check for variable existence (truthiness) is present.

@jsf-clabot
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

@jrburke jrburke added this to the 2.3.7 milestone Feb 23, 2020
@jrburke
Copy link
Member

jrburke commented Feb 23, 2020

Thanks for the change. I know it is a small change, but if you could sign the CLA, linked above, that will clear this change to be merged into the tree.

@senthilkumar04
Copy link

@sergemarkin please help with the signing of the contributor license agreement in order to proceed with the merging of this PR

Copy link

@senthilkumar04 senthilkumar04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are fine and it will resolve the typeerror issue while parsing the contents of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants