Fix crash in SwXTextDocument::getSelection() method.

pWrtShell was nullptr. This crash was triggered by
an collaborative editing use case.

Change-Id: Id64298b424f5ac4d96df97581c6fe3067e799eb3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108417
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 18f84f8..338230b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3581,7 +3581,7 @@ uno::Reference<datatransfer::XTransferable> SwXTextDocument::getSelection()
    uno::Reference<datatransfer::XTransferable> xTransferable;

    SwWrtShell* pWrtShell = m_pDocShell->GetWrtShell();
    if (SdrView* pSdrView = pWrtShell->GetDrawView())
    if (SdrView* pSdrView = pWrtShell ? pWrtShell->GetDrawView() : nullptr)
    {
        if (pSdrView->GetTextEditObject())
        {