sw/source/uibase/shells/textsh1.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit aab33f804929c4823f9ac085b357859b68a4028a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Jul 18 08:21:43 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Jul 18 17:56:49 2022 +0200

    sw: fix crash in SwTextShell::Execute()
    
    Crashreport signature:
    
            SwTextShell::Execute(SfxRequest&)
                    sw/source/uibase/shells/textsh1.cxx:1540
            SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, 
bool)
                    sfx2/source/control/dispatch.cxx:256
            SfxDispatcher::Execute(unsigned short, SfxCallMode, SfxItemSet 
const*, SfxItemSet const*, unsigned short)
                    sfx2/source/control/dispatch.cxx:811
            SfxDispatchController_Impl::dispatch(com::sun::star::util::URL 
const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> 
const&, 
com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> 
const&)
                    sfx2/source/control/unoctitm.cxx:671
    
    This is the Grammar case, the Spelling case already checked for an empty
    xDictionary reference.
    
    Change-Id: If1f88e4bdf2d68d877fbb0bd89d0cadbd493771f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137198
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit c6d242ebf0d3ca5e57ac7d6e894d800faa38d15a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137175
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 4531da1486f3..4c5e42bc5d59 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1538,9 +1538,12 @@ void SwTextShell::Execute(SfxRequest &rReq)
                     SwPaM *pPaM = rWrtSh.GetCursor();
                     if (pPaM)
                         SwEditShell::IgnoreGrammarErrorAt( *pPaM );
-                    // refresh the layout of all paragraphs (workaround to 
launch a dictionary event)
-                    xDictionary->setActive(false);
-                    xDictionary->setActive(true);
+                    if (xDictionary.is())
+                    {
+                        // refresh the layout of all paragraphs (workaround to 
launch a dictionary event)
+                        xDictionary->setActive(false);
+                        xDictionary->setActive(true);
+                    }
                 }
                 catch( const uno::Exception& )
                 {

Reply via email to