Fix error when deleting an empty list of refs Closes #45743 See merge request gitlab-org/gitlab-ce!19053