RangeError: Error #1005:

RangeError: Error #1005: Array index is not a positive integer (-1).
at Error$/throwError()
at Array()
at Box2D.Dynamics::b2Island()
at Box2D.Dynamics::b2World/Solve()
at Box2D.Dynamics::b2World/Step()

At this line:
m_contacts = new Array(contactCapacity);

I've been looking through the forums and have read that the RangeError is thrown when bodies are destroyed that have already been destroyed. I am not destroying bodies and I still get that error. I have found no way to produce that error consistently so I am having a really hard time trying to solve it. Are there any other reasons why this error might occur?

I am using 2.0.2. Thank you.
Looks to me like your setting your Array size to be -1, check the value of contactCapacity- maybe some math went wrong somewhere and it messed it up
That's the thing, I'm not setting that value. That's all engine stuff. I don't even know what contactCapacity is or what it means.

Original thread: https://box2d.org/forum/viewtopic.php?t=4717