jsprime icon indicating copy to clipboard operation
jsprime copied to clipboard

Odd error message

Open Hax0rG1rl opened this issue 6 years ago • 1 comments

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.

Hax0rG1rl avatar Apr 26 '18 03:04 Hax0rG1rl

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.

TejaswiniU avatar Jul 21 '20 19:07 TejaswiniU