Check if arrays are valid before used in foreach loops