diff options
author | Andras Timar <andras.timar@collabora.com> | 2015-05-28 17:22:48 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-05-28 19:53:11 +0000 |
commit | 62031cd02d1fbb27c2e5bc9eee2a8dd7c7c9e295 (patch) | |
tree | 5db544ef1d2cfe0799cc4bab45f059581667ebd6 /oox | |
parent | 53a066b7d1a639c6d31655bfc7c6257896fb57ef (diff) |
DrawingML export crash fix
Change-Id: I777c6734a7f63240e9021152ecff0a86f530ff8f
Reviewed-on: https://gerrit.libreoffice.org/15951
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/drawingml.cxx | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index c7af2b80a244..3887e0eae865 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2222,18 +2222,6 @@ void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape ) } - mpFS->startElementNS( XML_a, XML_custGeom, FSEND ); - mpFS->singleElementNS( XML_a, XML_avLst, FSEND ); - mpFS->singleElementNS( XML_a, XML_gdLst, FSEND ); - mpFS->singleElementNS( XML_a, XML_ahLst, FSEND ); - mpFS->singleElementNS( XML_a, XML_rect, - XML_l, "l", - XML_t, "t", - XML_r, "r", - XML_b, "b", - FSEND ); - - mpFS->startElementNS( XML_a, XML_pathLst, FSEND ); uno::Sequence< beans::PropertyValue > const * pGeometrySeq = static_cast<uno::Sequence< beans::PropertyValue > const *>(aAny.getValue()); @@ -2251,7 +2239,6 @@ void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape ) uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aPairs; uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments; uno::Sequence<awt::Size> aPathSize; - bool bHasSubViewSize = false; for (int j = 0; j < aPathProp.getLength(); ++j ) { const beans::PropertyValue& rPathProp = aPathProp[j]; @@ -2260,13 +2247,21 @@ void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape ) else if (rPathProp.Name == "Segments") rPathProp.Value >>= aSegments; else if (rPathProp.Name == "SubViewSize") - { rPathProp.Value >>= aPathSize; - bHasSubViewSize = true; - } } - if ( bHasSubViewSize ) + if ( !aPairs.hasElements() || !aSegments.hasElements() ) + return; + + mpFS->startElementNS( XML_a, XML_custGeom, FSEND ); + mpFS->singleElementNS( XML_a, XML_avLst, FSEND ); + mpFS->singleElementNS( XML_a, XML_gdLst, FSEND ); + mpFS->singleElementNS( XML_a, XML_ahLst, FSEND ); + mpFS->singleElementNS( XML_a, XML_rect, XML_l, "l", XML_t, "t", + XML_r, "r", XML_b, "b", FSEND ); + mpFS->startElementNS( XML_a, XML_pathLst, FSEND ); + + if ( aPathSize.hasElements() ) { mpFS->startElementNS( XML_a, XML_path, XML_w, I64S( aPathSize[0].Width ), @@ -2395,13 +2390,12 @@ void DrawingML::WriteCustomGeometry( Reference< XShape > rXShape ) } } mpFS->endElementNS( XML_a, XML_path ); + mpFS->endElementNS( XML_a, XML_pathLst ); + mpFS->endElementNS( XML_a, XML_custGeom ); } } } - mpFS->endElementNS( XML_a, XML_pathLst ); - - mpFS->endElementNS( XML_a, XML_custGeom ); } void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon ) |