diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-24 16:26:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-24 21:22:23 +0100 |
commit | b9646ced245fe89d5a1e8b48fc5af533a94da2a6 (patch) | |
tree | 66fd74fc2d8445e96ae9c7d1823f488a934e11b4 /sw/source/filter/ww8/docxsdrexport.cxx | |
parent | 771a256685ca44481252fac6854e88ff6630298d (diff) |
crashtesting: assert of unbalanced tags on exporting tdf94591-1.odt to docx
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 <caolanm@redhat.com>
Diffstat (limited to 'sw/source/filter/ww8/docxsdrexport.cxx')
-rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 22 |
1 files 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<double>()), XML_y, - OString::number(aCoords[i].Second.Value.get<double>())); + 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<double>()), XML_y, + OString::number(aCoords[i].Second.Value.get<double>())); + } + 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); |