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 <hr@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.kaganski@collabora.com>
(cherry picked from commit 4afb80eaa0df58b78e2bfad892f9e7ce5e1bce7a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137962
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 398f877..8ab6859 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1986,8 +1986,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();
}
@@ -2015,8 +2017,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();
}
@@ -2071,8 +2075,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();