prevent passing NULL to memcpy (closes #22605)

Patch by Jakub Wilk.
1 file changed