SI-7128 Fix regression in copyToArray for empty arrays

As seen in Akka.

Review by @JamesIry