SI-7128 Fix regression in copyToArray for empty arrays