check empty before get

ids list can be empty after delete command
Fix IndexOutOfBoundsException