diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-05-25 12:15:00 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2019-12-22 16:22:57 +0100 |
commit | d33378691500f02c8004645dadd403c2a72e4fee (patch) | |
tree | 396b97ebe383ae50537ba164e38183d2515051f0 /sd | |
parent | 0a2dae2b4d23425e5c2b499d4981bb501a99ca77 (diff) |
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>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index d3bd66724c7b..e67d823e9a11 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}); - // 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); + if (mpView->IsTextEdit()) + { + // end text edition before starting it again + mpView->SdrEndTextEdit(); + } - mpSearchSpellTextObj->setActiveText( mnText ); + // 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); - // Turn on the edit mode for the text object. - mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this, pOutlinerView, true, true, bGrabFocus); + mpSearchSpellTextObj->setActiveText(mnText); - SetUpdateMode(true); - mbFoundObject = true; + // 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 |