From fd4410aa5fd079e4277297f1fb70ad8c728e7a17 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 21 Apr 2022 18:06:57 +0200 Subject: tdf#145240: Can't save drawing if I'm adding a short freeform line with no fill Here are the steps of the dup tdf#148693: 1. Open a new sheet in LibreOffice Draw 2. Select the tool Shape/Insert/Curves and Polygons 3. Draw a short line (I mean very short) 4. Click "File" > "Save" and select a random place to save => 1 0x00007fcd3c774fcb in o3tl::doAccess(com::sun::star::uno::Any const&) (any= uno::Any("[][]com.sun.star.awt.Point": uno::Sequence of length 1 = {uno::Sequence of length 2 = {{X = 0, Y = 0}, {X = 252, Y = 0}}})) at include/o3tl/any.hxx:284 2 0x00007fcd3c74f759 in XMLShapeExport::ImpExportPolygonShape(com::sun::star::uno::Reference const&, XmlShapeType, XMLShapeExportFlags, com::sun::star::awt::Point*) (this=0x8770560, xShape=uno::Reference to (SvxShapePolyPolygon *) 0x7bcb3a8, eShapeType=XmlShapeTypeDrawOpenBezierShape, nFeatures=15, pRefPoint=0x0) at xmloff/source/draw/shapeexport.cxx:2342 3 0x00007fcd3c74d952 in XMLShapeExport::exportShape(com::sun::star::uno::Reference const&, XMLShapeExportFlags, com::sun::star::awt::Point*, SvXMLAttributeList*) (this=0x8770560, xShape=uno::Reference to (SvxShapePolyPolygon *) 0x7bcb3a8, nFeatures=15, pRefPoint=0x0, pAttrList=0x0) at xmloff/source/draw/shapeexport.cxx:811 4 0x00007fcd3c75cca1 in XMLShapeExport::exportShapes(com::sun::star::uno::Reference const&, XMLShapeExportFlags, com::sun::star::awt::Point*) (this=0x8770560, xShapes=uno::Reference to (SdDrawPage *) 0x2d6b258, nFeatures=15, pRefPoint=0x0) at xmloff/source/draw/shapeexport.cxx:1006 Change-Id: Ie6d626999bf606f951f4f79a7c314559a9a886f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133273 Tested-by: Julien Nabet Reviewed-by: Julien Nabet --- xmloff/source/draw/shapeexport.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 55de243f07aa..9b069a07eb2c 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2338,11 +2338,13 @@ void XMLShapeExport::ImpExportPolygonShape( { // get PolygonBezier uno::Any aAny( xPropSet->getPropertyValue("Geometry") ); - const basegfx::B2DPolyPolygon aPolyPolygon( - basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*o3tl::doAccess(aAny))); - - if(aPolyPolygon.count()) + auto pSourcePolyPolygon = o3tl::tryAccess(aAny); + if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength()) { + const basegfx::B2DPolyPolygon aPolyPolygon( + basegfx::utils::UnoPolyPolygonBezierCoordsToB2DPolyPolygon( + *pSourcePolyPolygon)); + // complex polygon shape, write as svg:d const OUString aPolygonString( basegfx::utils::exportToSvgD( -- cgit