Don't I need this check before trying to get the array index in the next line?