From b9646ced245fe89d5a1e8b48fc5af533a94da2a6 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 24 Feb 2021 16:26:31 +0000 Subject: crashtesting: assert of unbalanced tags on exporting tdf94591-1.odt to docx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit because tdf94591-1.odt has coordinates we can't parse, resulting in nulls where the export expects a number and the exception is thrown causing close tags to be omitted, put the coordinate parsing into an exception block of its own so the close tags are emitted Change-Id: Ibf17e6204f360d5c9266ed010e25f9455de2d22b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111493 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/filter/ww8/docxsdrexport.cxx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 94c5e12ac711..df4ce254908d 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -850,12 +850,22 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons m_pImpl->getSerializer()->startElementNS(XML_wp, XML_wrapPolygon, XML_edited, "0"); - // There are the coordinates - for (sal_Int32 i = 0; i < aCoords.getLength(); i++) - m_pImpl->getSerializer()->singleElementNS( - XML_wp, (i == 0 ? XML_start : XML_lineTo), XML_x, - OString::number(aCoords[i].First.Value.get()), XML_y, - OString::number(aCoords[i].Second.Value.get())); + try + { + // There are the coordinates + for (sal_Int32 i = 0; i < aCoords.getLength(); i++) + m_pImpl->getSerializer()->singleElementNS( + XML_wp, (i == 0 ? XML_start : XML_lineTo), XML_x, + OString::number(aCoords[i].First.Value.get()), XML_y, + OString::number(aCoords[i].Second.Value.get())); + } + catch (const uno::Exception& e) + { + // e.g. on exporting first attachment of tdf#94591 to docx + TOOLS_WARN_EXCEPTION( + "sw.ww8", + "DocxSdrExport::startDMLAnchorInline: bad coordinate: " << e.Message); + } m_pImpl->getSerializer()->endElementNS(XML_wp, XML_wrapPolygon); -- cgit