jsprime
jsprime copied to clipboard
Odd error message
Hi there,
Trying to check a simple JS file I got this error:
/jsprime/jsprime-node/engine.js:1530
if (node2.argument.name != undefined)
^
TypeError: Cannot read property 'name' of null
at /jsprime/jsprime-node/engine.js:1530:32
at traverseMini (/jsprime/jsprime-node/engine.js:84:3)
at /jsprime/jsprime-node/engine.js:92:13
at Array.forEach (<anonymous>)
at traverseMini (/jsprime/jsprime-node/engine.js:91:17)
at traverseMini (/jsprime/jsprime-node/engine.js:95:11)
at /jsprime/jsprime-node/engine.js:92:13
at Array.forEach (<anonymous>)
at traverseMini (/jsprime/jsprime-node/engine.js:91:17)
at getFunctions (/jsprime/jsprime-node/engine.js:1527:9)
Any ideas how to solve this?
Regards.
I hope by now you would have got the solution If not change if (node2.argument.name != undefined) to if (node2.argument!=undefined & node2.argument.name != undefined)
Reason : By the error msg its simple that when traversing through AST there are cases where the node may have a null argument. Since we are trying for name object it is throwing error.