Don’t try to remove objects from an empty array

Check that the array has at least one thing in it before trying to remove the first item.