Uncaught Type Error Within my Array Statement

As the title says, I am getting the following error in my code

Uncaught TypeError: Cannot read properties of undefined (reading ‘length’)

This is the location of the error

//Initial Array for ovens
var ovens_init = new Array();
ovens_init[1] = [];
ovens_init[2] = [];
ovens_init[3] = [];
ovens_init[4] = [];
ovens_init[5] = [];


//Figures out the max length of the inital arrays
var oven_max_length = 0;
for (i = 1; i < 6; i++){
  if(ovens_init[i][0].length > oven_max_length){
    oven_max_length = ovens_init[i][0].length;
  }
}

The code runs fine when they array has data but when its empty I get the following code above. What can I add to my code to allow the program to run, even when it is empty?