check the emptiness of the array before doing 'restaurant = filteredRestaurants.get(i);'