shcore: Check optional pointer in filestream_CopyTo() before writing to it.
Check that the 'written' parameter in this function is non-null before incrementing it by 'written_chunk'.
Check that the 'written' parameter in this function is non-null before incrementing it by 'written_chunk'.