sw/source/uibase/app/docstyle.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
New commits: commit ef6fb0eda1d875e1d7975152d966fba33f431c26 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Aug 3 09:47:40 2022 +0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Aug 10 09:09:15 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> (cherry picked from commit 4afb80eaa0df58b78e2bfad892f9e7ce5e1bce7a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137961 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index efaf6853e0ad..fa53a595f2fd 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();