sw/source/uibase/shells/textfld.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
New commits: commit fca39498dfc29a1c026ff854ca797ea39161124b 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 11:14:39 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> (cherry picked from commit 1dc16c277107f8f67b52c1b3eaef21e0f2d20fde) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157213 Tested-by: Jenkins diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 53fd4471ce37..d8da30749cc7 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -462,13 +462,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()); + } } } }