Prevent null pointer being passed to memcpy
Ensure that the vector just created has valid data as this is passed to memcpy as the destination. Passing a null pointer here will result in a segfault.

Fixes: https://github.com/tensorflow/tensorflow/issues/61677