sw/source/uibase/app/docstyle.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
New commits: commit 4afb80eaa0df58b78e2bfad892f9e7ce5e1bce7a Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Aug 3 09:47:40 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Aug 3 14:41:18 2022 +0200 tdf#150241: a blind fix attempt I can't repro it locally (the report misses clear repro steps), but the three changed OUString assignment operators use rtl::str::assign internally, and the unconditional dereference of the value returned from SwDoc::GetDocPattern (that may return a nullptr) is suspicious, especially compared to the checks made in SwDocStyleSheet::GetHelpId later in the same file. All four calls to GetDocPattern in the file were introduced in commit 7b0b5cdfeed656b279bc32cd929630d5fc25878b Author Jens-Heiner Rechtien <h...@openoffice.org> Date Mon Sep 18 16:15:01 2000 +0000 initial import Change-Id: If9d4cff921443e5af71b7d541b79d00ea77e853b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137734 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 7bc284a4824f..c374d4c79767 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -1980,8 +1980,10 @@ bool SwDocStyleSheet::FillStyleSheet( { nPoolId = m_pDesc->GetPoolFormatId(); nHelpId = m_pDesc->GetPoolHelpId(); - if( m_pDesc->GetPoolHlpFileId() != UCHAR_MAX ) - aHelpFile = *m_rDoc.GetDocPattern( m_pDesc->GetPoolHlpFileId() ); + if (const OUString* pattern = m_pDesc->GetPoolHlpFileId() != UCHAR_MAX + ? m_rDoc.GetDocPattern(m_pDesc->GetPoolHlpFileId()) + : nullptr) + aHelpFile = *pattern; else aHelpFile.clear(); } @@ -2009,8 +2011,10 @@ bool SwDocStyleSheet::FillStyleSheet( { nPoolId = m_pNumRule->GetPoolFormatId(); nHelpId = m_pNumRule->GetPoolHelpId(); - if( m_pNumRule->GetPoolHlpFileId() != UCHAR_MAX ) - aHelpFile = *m_rDoc.GetDocPattern( m_pNumRule->GetPoolHlpFileId() ); + if (const OUString* pattern = m_pNumRule->GetPoolHlpFileId() != UCHAR_MAX + ? m_rDoc.GetDocPattern(m_pNumRule->GetPoolHlpFileId()) + : nullptr) + aHelpFile = *pattern; else aHelpFile.clear(); } @@ -2065,8 +2069,10 @@ bool SwDocStyleSheet::FillStyleSheet( OSL_ENSURE( m_bPhysical, "Format not found" ); nHelpId = pFormat->GetPoolHelpId(); - if( pFormat->GetPoolHlpFileId() != UCHAR_MAX ) - aHelpFile = *m_rDoc.GetDocPattern( pFormat->GetPoolHlpFileId() ); + if (const OUString* pattern = pFormat->GetPoolHlpFileId() != UCHAR_MAX + ? m_rDoc.GetDocPattern(pFormat->GetPoolHlpFileId()) + : nullptr) + aHelpFile = *pattern; else aHelpFile.clear();