JS does a lot of automagic behind the scene if you don’t work with pragma strict. This includes autocasting, autocasting to a usefull type and access a field and all this kind of stuff that can make it pretty hairy to convert things.
For example if you have game objects in the array there and try to access autowaypoints in the loop, JS will likely work but on C# it will fail misserably because a game object is and never can be an autowaypoint, it can only contain a component of that type.
How can you have an instance of something that is null? They are mutually exclusive concepts.
Making the value null will create the null reference exceptions, not avoid them.
I think the real cause to this is that you cannot run a foreach loop in C# against a null reference. In JavaScript, I believe you can (it will skip the loop) or it will fail silently and move onto the next line (I don’t think that happens in Unity). So the solution would be to make sure that an ArrayList has been instantiated and assigned to the “waypoints” field.
Seeing as this thread is almost a year old though, I don’t think it matters anymore to revive or solve the issue.