diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-03 09:47:40 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-08-03 14:41:18 +0200 |
commit | 4afb80eaa0df58b78e2bfad892f9e7ce5e1bce7a (patch) | |
tree | 284b836c34e265228f58dc6de1802c79b2b966f1 /sw/source/uibase/app | |
parent | c7760b326cbfe553184e16f221391ecf27b9bc48 (diff) |
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>
Diffstat (limited to 'sw/source/uibase/app')
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
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(); |