Paste: check if source doc is null. This fixes bug 41850. Thanks to Richard Frovarp for the patch.
Changed paths: