oox/source/export/drawingml.cxx | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-)
New commits: commit 62031cd02d1fbb27c2e5bc9eee2a8dd7c7c9e295 Author: Andras Timar <andras.ti...@collabora.com> Date: Thu May 28 17:22:48 2015 +0200 DrawingML export crash fix Change-Id: I777c6734a7f63240e9021152ecff0a86f530ff8f Reviewed-on: https://gerrit.libreoffice.org/15951 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Andras Timar <andras.ti...@collabora.com> diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index c7af2b8..3887e0e 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 ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits