summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-04-27 05:38:32 +0300
committerMichael Stahl <michael.stahl@allotropia.de>2021-04-27 10:17:35 +0200
commit85ebaaea6c794caff37042beb04c6cb81bfc9e3f (patch)
tree6eaf6ec66d22c21f059b139e2099404eb7ad21ef
parenttdf#141887 SW don't crash on missing SwWrtShell (diff)
downloadcore-85ebaaea6c794caff37042beb04c6cb81bfc9e3f.tar.gz
core-85ebaaea6c794caff37042beb04c6cb81bfc9e3f.zip
tdf#141924: SwFormatAutoFormat::GetStyleHandle may return nullptr
Change-Id: Id1b6fe687f5b328fa0743036a287bacfefe5e5fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114685 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114687 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit d1ac603b006a14c3cf8c8f852eb481a27e3c46fa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114608 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 0186b5f9613f..8c09a63113fa 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -312,17 +312,19 @@ static uno::Any GetParaListAutoFormat(SwTextNode const& rNode)
{
return uno::Any();
}
- SfxItemSet const& rSet(*pFormat->GetStyleHandle());
+ const auto pSet(pFormat->GetStyleHandle());
+ if (!pSet)
+ return {};
SfxItemPropertySet const& rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE));
SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap());
std::vector<beans::NamedValue> props;
// have to iterate the map, not the item set?
for (auto const& rEntry : rMap.getPropertyEntries())
{
- if (rPropSet.getPropertyState(rEntry, rSet) == PropertyState_DIRECT_VALUE)
+ if (rPropSet.getPropertyState(rEntry, *pSet) == PropertyState_DIRECT_VALUE)
{
Any value;
- rPropSet.getPropertyValue(rEntry, rSet, value);
+ rPropSet.getPropertyValue(rEntry, *pSet, value);
props.emplace_back(rEntry.sName, value);
}
}