sd/qa/unit/data/ppt/pass/ofz37370-1.ppt |binary svx/source/svdraw/svdotxtr.cxx | 27 ++++++++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-)
New commits: commit 9343551f5588ffa4916e2c5d33cbd6fcf56ca99d Author: Caolán McNamara <[email protected]> AuthorDate: Thu Aug 19 09:32:40 2021 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Aug 19 14:59:23 2021 +0200 ofz#37370 Null-dereference since... commit 5b025285b3528910a4360899abb2bbbaadc72c97 Date: Wed Aug 18 07:35:05 2021 +0200 Simplify Rect2Poly where tools::Polygon from tools::Rectangle ctor has special handling for an 'empty' Rectangle Change-Id: Ifb93efeee4c2c1fe1f9fe5422e0e648ad91da77a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120702 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/qa/unit/data/ppt/pass/ofz37370-1.ppt b/sd/qa/unit/data/ppt/pass/ofz37370-1.ppt new file mode 100644 index 000000000000..87f904c7477a Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/ofz37370-1.ppt differ diff --git a/svx/source/svdraw/svdotxtr.cxx b/svx/source/svdraw/svdotxtr.cxx index e499a332400c..0b667f18ce0c 100644 --- a/svx/source/svdraw/svdotxtr.cxx +++ b/svx/source/svdraw/svdotxtr.cxx @@ -239,20 +239,21 @@ void SdrTextObj::NbcMirror(const Point& rRef1, const Point& rRef2) std::abs(rRef1.X()-rRef2.X())==std::abs(rRef1.Y()-rRef2.Y()))) { bRotate90=maGeo.nRotationAngle.get() % 9000 ==0; } - tools::Polygon aPol(Rect2Poly(maRect,maGeo)); - sal_uInt16 i; - sal_uInt16 nPointCount=aPol.GetSize(); - for (i=0; i<nPointCount; i++) { - MirrorPoint(aPol[i],rRef1,rRef2); + if (!maRect.IsEmpty()) { // ofz#37370 an 'empty' rect creates a polygon with 0 points + tools::Polygon aPol(Rect2Poly(maRect,maGeo)); + sal_uInt16 nPointCount = aPol.GetSize(); + for (sal_uInt16 i = 0; i < nPointCount; ++i) { + MirrorPoint(aPol[i],rRef1,rRef2); + } + // turn polygon and move it a little + tools::Polygon aPol0(aPol); + aPol[0]=aPol0[1]; + aPol[1]=aPol0[0]; + aPol[2]=aPol0[3]; + aPol[3]=aPol0[2]; + aPol[4]=aPol0[1]; + Poly2Rect(aPol,maRect,maGeo); } - // turn polygon and move it a little - tools::Polygon aPol0(aPol); - aPol[0]=aPol0[1]; - aPol[1]=aPol0[0]; - aPol[2]=aPol0[3]; - aPol[3]=aPol0[2]; - aPol[4]=aPol0[1]; - Poly2Rect(aPol,maRect,maGeo); if (bRotate90) { bool bRota90=maGeo.nRotationAngle.get() % 9000 ==0;
