check the emptiness of the array before doing 'restaurant = filteredRest...

...aurants.get(i);'