Avoid segfault

If the user clicks the "copy" button (or uses the Ctrl+C accelerator)
without having selected something first, we had a NULL pointer
dereference.

Avoid by explicitly testing whether the text is non-NULL