summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2005-09-28 10:57:10 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2005-09-28 10:57:10 +0000
commit61392f39147ffd2b857fe7e8dff6bb986a09b26c (patch)
tree8ab7967f89f3f61434c5cd36cf41278d87294e93 /tools
parent6211f5b5e4220c5068c2a0edaf09f38e673e4f08 (diff)
INTEGRATION: CWS sj24 (1.5.138); FILE MERGED
2005/08/17 13:03:14 sj 1.5.138.1: #123923# fixed gpf when converting polygons to b2dpolygons if the polygon is having only one control point at the end
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/poly.cxx31
1 files changed, 18 insertions, 13 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index ffbe320f8368..f1adf653ec11 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: poly.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: hr $ $Date: 2005-09-23 13:41:07 $
+ * last change: $Author: hr $ $Date: 2005-09-28 11:57:10 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -2197,18 +2197,23 @@ void Polygon::Write( SvStream& rOStream ) const
{
// get two control points
Point aControlA = mpImplPolygon->mpPointAry[a++];
- Point aControlB = mpImplPolygon->mpPointAry[a++];
- // add point A
- ::basegfx::B2DPoint aPoA(aPointA.X(), aPointA.Y());
- aRetval.append(aPoA);
-
- // calculate Vectors and add them
- const sal_uInt32 nDestIndex(aRetval.count() - 1L);
- ::basegfx::B2DVector aVeA(aControlA.X() - aPointA.X(), aControlA.Y() - aPointA.Y());
- aRetval.setControlVectorA(nDestIndex, aVeA);
- ::basegfx::B2DVector aVeB(aControlB.X() - aPointA.X(), aControlB.Y() - aPointA.Y());
- aRetval.setControlVectorB(nDestIndex, aVeB);
+ DBG_ASSERT( a < nCount, "Polygon::getB2DPolygon(): invalid polygon (polygon is ending with only one control point)" );
+ if ( a < nCount )
+ {
+ Point aControlB = mpImplPolygon->mpPointAry[a++];
+
+ // add point A
+ ::basegfx::B2DPoint aPoA(aPointA.X(), aPointA.Y());
+ aRetval.append(aPoA);
+
+ // calculate Vectors and add them
+ const sal_uInt32 nDestIndex(aRetval.count() - 1L);
+ ::basegfx::B2DVector aVeA(aControlA.X() - aPointA.X(), aControlA.Y() - aPointA.Y());
+ aRetval.setControlVectorA(nDestIndex, aVeA);
+ ::basegfx::B2DVector aVeB(aControlB.X() - aPointA.X(), aControlB.Y() - aPointA.Y());
+ aRetval.setControlVectorB(nDestIndex, aVeB);
+ }
}
else
{