sd: LOK: don't access null dispatcher

With SpellDialog invoked from multiple views
the dispatcher can indeed be null in some cases.

(cherry picked from commit b18c12f4dbe91379cef795d559c2d84341e32a75)

Reviewed-on: https://gerrit.libreoffice.org/83631
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit 188ff24ee209d4f5f8ec6a6ae82241e56f0be6d5)

Change-Id: Ic2950e70383a77d63438341fac174d369748b36a
Reviewed-on: https://gerrit.libreoffice.org/85676
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index d3bd667..e67d823 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1402,29 +1402,33 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
    // Make FuText the current function.
    SfxUInt16Item aItem (SID_TEXTEDIT, 1);
    std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
    pViewShell->GetDispatcher()->ExecuteList(SID_TEXTEDIT,
            SfxCallMode::SYNCHRON | SfxCallMode::RECORD, { &aItem });

    if (mpView->IsTextEdit())
    if (pViewShell && pViewShell->GetDispatcher())
    {
        // end text edition before starting it again
        mpView->SdrEndTextEdit();
        pViewShell->GetDispatcher()->ExecuteList(
            SID_TEXTEDIT, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, {&aItem});

        if (mpView->IsTextEdit())
        {
            // end text edition before starting it again
            mpView->SdrEndTextEdit();
        }

        // To be consistent with the usual behaviour in the Office the text
        // object that is put into edit mode would have also to be selected.
        // Starting the text edit mode is not enough so we do it here by
        // hand.
        mpView->UnmarkAllObj(pPV);
        mpView->MarkObj(mpSearchSpellTextObj, pPV);

        mpSearchSpellTextObj->setActiveText(mnText);

        // Turn on the edit mode for the text object.
        mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this,
                                pOutlinerView, true, true, bGrabFocus);

        SetUpdateMode(true);
        mbFoundObject = true;
    }

    // To be consistent with the usual behaviour in the Office the text
    // object that is put into edit mode would have also to be selected.
    // Starting the text edit mode is not enough so we do it here by
    // hand.
    mpView->UnmarkAllObj (pPV);
    mpView->MarkObj (mpSearchSpellTextObj, pPV);

    mpSearchSpellTextObj->setActiveText( mnText );

    // Turn on the edit mode for the text object.
    mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this, pOutlinerView, true, true, bGrabFocus);

    SetUpdateMode(true);
    mbFoundObject = true;
}

ESelection SdOutliner::GetSearchStartPosition() const