ids list can be empty

check empty before get(0)