sw/source/uibase/shells/textfld.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 6c39caedbe08f44683f14eabae4e96c3642c4e44
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Sep 22 15:40:17 2023 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Sep 25 09:52:25 2023 +0200

    sw: fix crash in SwTextShell::ExecField()
    
    Crashreport signature:
    
    Fatal signal received: SIGSEGV code: 128 for address: 0x0
    
    program/libswlo.so
            SwTextShell::ExecField(SfxRequest&)
                    sw/source/uibase/shells/textfld.cxx:456
    program/libmergedlo.so
            SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, 
bool)
                    sfx2/source/control/dispatch.cxx:257
    program/libmergedlo.so
            SfxDispatcher::Execute(unsigned short, SfxCallMode, SfxItemSet 
const*, SfxItemSet const*, unsigned short)
                    sfx2/source/control/dispatch.cxx:814
    program/libmergedlo.so
            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:682
    
    Change-Id: I359f9ee643daff9acfb67800e38666cce060c0b6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157171
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index b0603d4eed96..9a5d1ac5ee73 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -452,13 +452,17 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                         pMgr->RegisterAnswerText(sText);
                         pWin->ExecuteCommand(nSlot);
 
-                        // Set the parent postit id of the reply.
-                        
GetView().GetPostItMgr()->GetLatestPostItField()->SetParentPostItId(pIdItem->GetValue().toUInt32());
+                        SwPostItField* pLatestPostItField = 
pMgr->GetLatestPostItField();
+                        if (pLatestPostItField)
+                        {
+                            // Set the parent postit id of the reply.
+                            
pLatestPostItField->SetParentPostItId(pIdItem->GetValue().toUInt32());
 
-                        // If name of the replied comment is empty, we need to 
set a name in order to connect them in the xml file.
-                        pWin->GeneratePostItName(); // Generates a name if the 
current name is empty.
+                            // If name of the replied comment is empty, we 
need to set a name in order to connect them in the xml file.
+                            pWin->GeneratePostItName(); // Generates a name if 
the current name is empty.
 
-                        
GetView().GetPostItMgr()->GetLatestPostItField()->SetParentName(pWin->GetPostItField()->GetName());
+                            
pLatestPostItField->SetParentName(pWin->GetPostItField()->GetName());
+                        }
                     }
                 }
             }

Reply via email to