sw/source/core/unocore/unoframe.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit 8325a8e3d5d442b5bb93e339e17a404b0576a351 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Feb 1 12:16:34 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Feb 2 17:01:30 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> (cherry picked from commit 62797844fed93d5e33505d544606e4d4e2530f8c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146413 Tested-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 381109f4e97e..cf1c9575c987 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1400,6 +1400,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") @@ -1409,9 +1411,9 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& SwDocModifyAndUndoGuard guard(*pFormat); 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); } @@ -1450,7 +1452,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)); @@ -1941,7 +1943,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 ) @@ -1986,8 +1988,6 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& m_nVisibleAreaHeight = sAspect.toInt64(); } } - else - throw uno::RuntimeException(); } namespace