adams85 / bundling

A library for optimizing and bundling web assets of ASP.NET Core applications.
MIT License
44 stars 7 forks source link

EcmaScript - NullReferenceException when variable is not declared #11

Closed ISV-Kran closed 4 years ago

ISV-Kran commented 4 years ago

Hi adams85,

On javascript when a variable is not declared we get System.NullReferenceException: 'Object reference not set to an instance of an object.' at VisitVariableDeclarator.

[TO REPRODUCE] On TypeScriptDemo add to foo.ts var i, length; just after the _timeout function.

[POSSIBLE FIX] Execute Visit(variableDeclarator.Init) only if Init is not null

protected override void VisitVariableDeclarator(VariableDeclarator variableDeclarator) { if (variableDeclarator.Init != null) { // id skipped Visit(variableDeclarator.Init); } }

Thank you

(I'm actually looking how to pull new request, sry i'm new to github)

adams85 commented 4 years ago

Nice catch! 👍

The bug will be fixed by v3.4.1 which will be available on NuGet soon.