Problem code C#

Hey, here is the snippet with some code that gives me error I do not understand

void  EngineSound (){

	int i;      
	for (  i= 0; i < gearRatio.Length; i++){
		if(gearRatio*> currentSpeed){*
  •  	break;*
    
  •  }*
    
  • }*

  • float gearMinValue = 0.00f;*

  • float gearMaxValue = 0.00f;*

  • if ( i == 0){*

  •  gearMinValue = 0;*
    
  • }*

  • else*

  • {*

  •  gearMinValue = gearRatio[i-1];*
    
  • }*

_ gearMaxValue = gearRatio*;_
_
float enginePitch = ((currentSpeed - gearMinValue)/(gearMaxValue - gearMinValue))+1;_
_
audio.pitch = enginePitch;_
_
}*_
Here is the error:
NullReferenceException: Object reference not set to an instance of an object
CarControl.EngineSound () (at Assets/Script/CarControl.cs:429)
CarControl.Update () (at Assets/Script/CarControl.cs:124)

gearMaxValue = gearRatio*;*
The problem is that after the for-loop i is going to be gearRatio.Length, which is outside the bounds of the array - the max being gearRatio.Length - 1.