sw/source/core/unocore/unoframe.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit 62797844fed93d5e33505d544606e4d4e2530f8c Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Feb 1 12:16:34 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Feb 1 11:11:16 2023 +0000 Throw early on invalid state The result of GetFrameFormat call was dereferenced unconditionally in the unit conversion code, despite it can obviously return NULL. Change-Id: I30117f1db942a8ff108a959891d8763c4d44fb39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146429 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 908f85a33e73..9051035e3866 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1387,6 +1387,8 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& { SolarMutexGuard aGuard; SwFrameFormat* pFormat = GetFrameFormat(); + if (!pFormat && !IsDescriptor()) + throw uno::RuntimeException(); // Hack to support hidden property to transfer textDirection if(rPropertyName == "FRMDirection") @@ -1395,9 +1397,9 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& { SvxFrameDirectionItem aItem(SvxFrameDirection::Environment, RES_FRAMEDIR); aItem.PutValue(_rValue, 0); - GetFrameFormat()->SetFormatAttr(aItem); + pFormat->SetFormatAttr(aItem); } - else if(IsDescriptor()) + else // if(IsDescriptor()) { m_pProps->SetProperty(o3tl::narrowing<sal_uInt16>(RES_FRAMEDIR), 0, _rValue); } @@ -1436,7 +1438,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& if(bDoIt) { - const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : GetFrameFormat()->GetDoc()); + const SwDoc* pDoc = (IsDescriptor() ? m_pDoc : pFormat->GetDoc()); const SfxItemPool& rPool = pDoc->GetAttrPool(); const MapUnit eMapUnit(rPool.GetMetric(pEntry->nWID)); @@ -1926,7 +1928,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& } } } - else if(IsDescriptor()) + else // if(IsDescriptor()) { m_pProps->SetProperty(pEntry->nWID, nMemberId, aValue); if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID ) @@ -1971,8 +1973,6 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& m_nVisibleAreaHeight = sAspect.toInt64(); } } - else - throw uno::RuntimeException(); } namespace