Prevent negative array index access when a line solely consists of newlines and spaces