You need to add another if-Block here because if the array is empty, nothing is returned