I am incluiding this check to avoid crash if the array is empty and we are trying to read the first element.