diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-23 21:43:41 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-05-24 15:48:02 +0200 |
commit | 3dfcc485b19f918f434f34ee0157f5dca96bad43 (patch) | |
tree | c2ebfb9789f2714c45bd6d2b1bad24de5b0ace87 /oox | |
parent | 51c639d1e85bc62fb8dec28faeed31ddb30c2854 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 53 |
1 files changed, 28 insertions, 25 deletions
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; } |