sw/source/core/inc/unofield.hxx | 2 +- sw/source/core/unocore/unofield.cxx | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-)
New commits: commit 5464a1dad69c52d011b194baf7d543ce8dd27748 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Apr 13 15:50:25 2023 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Apr 13 20:25:57 2023 +0200 Resolves: tdf#152619 crash inspecting uninserted XFieldMaster Change-Id: I765dd5d7e1ed2c1749841491a50216a6afe903c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150351 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 03761b0f28b3..019da24f7241 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1297,6 +1297,8 @@ SwXTextField::getTextFieldMaster() SolarMutexGuard aGuard; SwFieldType* pType = m_pImpl->GetFieldType(); + if (!pType && !m_pImpl->m_pDoc) // tdf#152619 + return nullptr; uno::Reference<beans::XPropertySet> const xRet( SwXFieldMaster::CreateXFieldMaster(m_pImpl->m_pDoc, pType)); return xRet; commit c0d3b50213ffbed1cd58226a35e325fb7c769ec0 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Apr 13 15:41:19 2023 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Apr 13 20:25:47 2023 +0200 pointer is always dereferenced make it a reference Change-Id: I77c5dc3a4d4f290f5020019f3f455b1fec2497ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150350 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx index 4a8138bf8df9..55214020c038 100644 --- a/sw/source/core/inc/unofield.hxx +++ b/sw/source/core/inc/unofield.hxx @@ -54,7 +54,7 @@ private: SwXFieldMaster(SwFieldType& rType, SwDoc * pDoc); /// descriptor - SwXFieldMaster(SwDoc* pDoc, SwFieldIds nResId); + SwXFieldMaster(SwDoc& rDoc, SwFieldIds nResId); public: diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 226a595d0aaf..03761b0f28b3 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -506,8 +506,8 @@ SwXFieldMaster::getSupportedServiceNames() return { "com.sun.star.text.TextFieldMaster", getServiceName(m_pImpl->m_nResTypeId) }; } -SwXFieldMaster::SwXFieldMaster(SwDoc *const pDoc, SwFieldIds const nResId) - : m_pImpl(new Impl(pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD), pDoc, nResId)) +SwXFieldMaster::SwXFieldMaster(SwDoc& rDoc, SwFieldIds const nResId) + : m_pImpl(new Impl(rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD), &rDoc, nResId)) { } @@ -534,7 +534,7 @@ SwXFieldMaster::CreateXFieldMaster(SwDoc * pDoc, SwFieldType *const pType, { SwXFieldMaster *const pFM( pType ? new SwXFieldMaster(*pType, pDoc) - : new SwXFieldMaster(pDoc, nResId)); + : new SwXFieldMaster(*pDoc, nResId)); xFM.set(pFM); if (pType) {
