IndexOutOfRangeException error for array points in range

I’ve created a Vector3 array with the length of four with this code (these are declared globally):

var contactpointSide : Vector3[] = new Vector3[4];
var contactnormalSide : Vector3[] = new Vector3[4];

and the array size in the inspector shows 4. Whenever I run the code, though, the size of the array changes to 0, and when I try to add vectors to the array, it gives me an IndexOutOfRangeException. Nowhere in the code do I modify or do anything related to the length of the vector, so I don’t know why the vector size keeps changing to zero. Can anyone spot my problem or have any ideas?

Here’s the code, with the offending lines marked (with unrelated stuff removed):

function OnCollisionStay (collision : Collision)
{
	for (var contact : ContactPoint in collision.contacts)
	{
        
...
        
        if(dotprod >= -0.5 && rotationprod > 0.7) // left
                {
        	// stuff here
        	        	
   //THIS LINE//contactpointSide[0] = contact.point;
   //THIS TOO// contactnormalSide[0] = contact.normal;
        	
                }
        }
}

#pragma strict
var contactpointSide : Vector3 = new Vector3[4];
var contactnormalSide : Vector3 = new Vector3[4];

function OnCollisionStay (collision : Collision)
{
	for (var contact : ContactPoint in collision.contacts)
	{
            // These 2 lines produce errors in your script 
            // because they have become null when 
            // this segment is executed
		contactpointSide[0] = contact.point;
		contactnormalSide[0] = contact.normal;
	}
}

I ran this with the collider/rigidbody properly setup, and I can see contactpointsSide and contactnormalSide updates to new values when the rigidbody this script is attached to dropped onto and collide with a plane.