NullReferenceException Error

So this is the deal. I have no error in the editor and everything is running smoothly. However when i run my build a script doesn’t work. I checked the output log and i saw this message:

NullReferenceException: Object reference not set to an instance of an object
at Matrix_Node_Row.updateCurveData (UnityEngine.AnimationCurve curveData) [0x00000] in :0

at Matrix_Node_Row.Update () [0x00000] in :0

(Filename: Line: -1)

So i went to the Matrix_Node_Row Class and checked the updateCurveData function. Here it is:

	public void updateCurveData(AnimationCurve curveData){
		if (curveData==null)
		{
			Debug.Log ("object "+this.ToString()+"is trying to run a null curveData");
		}
		if (this.curveData!=null || animateEnabled==true)
		{

			for (int i=0; i<row.Length; i++) {
				row<em>.inputCurveData (curveData.Evaluate ((i*step)+p_offset));</em>
  •  	}*
    
  •  }*
    
  • }*
  • public void updateCurveData(float curveData)*
  • {*
  •  if (curveData==null)*
    
  •  {*
    
  •  	Debug.Log ("object "+this.ToString()+"is trying to run a null curveData");*
    
  •  }*
    
  •  	if (this.curveData!=null || animateEnabled==true)*
    
  •  	{*
    
  •  		for (int i=0; i<row.Length; i++) {*
    

_ row*.inputCurveData (curveData);_
_
}_
_
}_
_
}_
The Update function looks like this:
if (animateEnabled)
_
{_
_
updateCurveData (curveData);_
_
//updateColorData (colorData);_
_
}*_
The debug meassage is not written to the log so curveData can’t be null. I don’t understand where something like this can stem from and i need to present my work tommorow!!

Thanks to everyone who replied, i have found the answer. I had to initialize objects prior to the start of the scene in order to keep the scene optimized. I placed these operation in OnValidate since i also wanted to make sure they were of a specific type. However i forgot to copy the initialization operation to the Awake function. So the array row was intialized in editor but not in build.