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 <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 1dc16c277107f8f67b52c1b3eaef21e0f2d20fde)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157213
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna
2023-09-25 11:14:39 +02:00
committed by Caolán McNamara
parent 0eb05b47a6
commit fca39498df
+9 -5
View File
@@ -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());
}
}
}
}