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

TypeError: Cannot set property 'parent' of null #19

Closed
nathanbowser opened this issue May 14, 2013 · 3 comments
Closed

TypeError: Cannot set property 'parent' of null #19

nathanbowser opened this issue May 14, 2013 · 3 comments

Comments

@nathanbowser
Copy link

If you try to walk the source of wysihtml5, detective will throw TypeError: Cannot set property 'parent' of null -- /node-detective/index.js:7:22

Here is a simple example that demonstrates the problem:

var detective = require('detective')
  , request = require('request')

request('https://raw.github.com/xing/wysihtml5/master/dist/wysihtml5-0.4.0pre.js', function (err, response, src) {
  console.dir(detective(src))
})

Here is the node it's looping over. I can't figure out what is causing the node to be null, but it looks like that comes from esprima or escodegen

[ null,
  { type: 'Literal', value: 0 },
  parent: { type: 'ArrayExpression',
    elements: [Circular],
    parent: 
     { type: 'LogicalExpression',
       operator: '||',
       left: [Object],
       right: [Circular],
       parent: [Object] } } ]

I found this issue when upgrading to browserify v2.

@nathanbowser
Copy link
Author

The null returned from esprima is caused by this [,0]. I'll throw together a test.

nathanbowser added a commit to nathanbowser/node-detective that referenced this issue May 14, 2013
nathanbowser added a commit to nathanbowser/node-detective that referenced this issue May 14, 2013
@zertosh
Copy link
Member

zertosh commented May 23, 2015

Fixed by #21

@zertosh zertosh closed this as completed May 23, 2015
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 a pull request may close this issue.

3 participants
@nathanbowser @zertosh and others