[Libreoffice-commits] core.git: oox/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 24 13:49:21 UTC 2019
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 53 ++++++++++----------
1 file changed, 28 insertions(+), 25 deletions(-)
New commits:
commit 3dfcc485b19f918f434f34ee0157f5dca96bad43
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 23 21:43:41 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri May 24 15:48:02 2019 +0200
crashtesting: div-by-zero on load of tdf48948-2.pptx
Change-Id: Id05f65543eeb06526535ce9eaee354b4789e2069
Reviewed-on: https://gerrit.libreoffice.org/72883
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index cab140cc84e8..dcd19a61c9e4 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -684,37 +684,40 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
}
const sal_Int32 nShapes = aCycleChildren.size();
- const sal_Int32 nConnectorRadius = nRadius * cos(basegfx::deg2rad(nSpanAngle / nShapes));
- const sal_Int32 nConnectorAngle = nSpanAngle > 0 ? 0 : 180;
-
- sal_Int32 idx = 0;
- for (auto & aCurrShape : aCycleChildren)
+ if (nShapes)
{
- const double fAngle = static_cast<double>(idx)*nSpanAngle/nShapes + nStartAngle;
- awt::Size aCurrSize = aChildSize;
- sal_Int32 nCurrRadius = nRadius;
- if (aCurrShape->getSubType() == XML_conn)
+ const sal_Int32 nConnectorRadius = nRadius * cos(basegfx::deg2rad(nSpanAngle / nShapes));
+ const sal_Int32 nConnectorAngle = nSpanAngle > 0 ? 0 : 180;
+
+ sal_Int32 idx = 0;
+ for (auto & aCurrShape : aCycleChildren)
{
- aCurrSize = aConnectorSize;
- nCurrRadius = nConnectorRadius;
- }
- const awt::Point aCurrPos(
- aCenter.Width + nCurrRadius*sin(basegfx::deg2rad(fAngle)) - aCurrSize.Width/2,
- aCenter.Height - nCurrRadius*cos(basegfx::deg2rad(fAngle)) - aCurrSize.Height/2);
+ const double fAngle = static_cast<double>(idx)*nSpanAngle/nShapes + nStartAngle;
+ awt::Size aCurrSize = aChildSize;
+ sal_Int32 nCurrRadius = nRadius;
+ if (aCurrShape->getSubType() == XML_conn)
+ {
+ aCurrSize = aConnectorSize;
+ nCurrRadius = nConnectorRadius;
+ }
+ const awt::Point aCurrPos(
+ aCenter.Width + nCurrRadius*sin(basegfx::deg2rad(fAngle)) - aCurrSize.Width/2,
+ aCenter.Height - nCurrRadius*cos(basegfx::deg2rad(fAngle)) - aCurrSize.Height/2);
- aCurrShape->setPosition(aCurrPos);
- aCurrShape->setSize(aCurrSize);
- aCurrShape->setChildSize(aCurrSize);
+ aCurrShape->setPosition(aCurrPos);
+ aCurrShape->setSize(aCurrSize);
+ aCurrShape->setChildSize(aCurrSize);
- if (nRotationPath == XML_alongPath)
- aCurrShape->setRotation(fAngle * PER_DEGREE);
+ if (nRotationPath == XML_alongPath)
+ aCurrShape->setRotation(fAngle * PER_DEGREE);
- // connectors should be handled in conn, but we don't have
- // reference to previous and next child, so it's easier here
- if (aCurrShape->getSubType() == XML_conn)
- aCurrShape->setRotation((nConnectorAngle + fAngle) * PER_DEGREE);
+ // connectors should be handled in conn, but we don't have
+ // reference to previous and next child, so it's easier here
+ if (aCurrShape->getSubType() == XML_conn)
+ aCurrShape->setRotation((nConnectorAngle + fAngle) * PER_DEGREE);
- idx++;
+ idx++;
+ }
}
break;
}
More information about the Libreoffice-commits
mailing list