[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 24 20:23:18 UTC 2021


 sw/source/filter/ww8/docxsdrexport.cxx |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

New commits:
commit b9646ced245fe89d5a1e8b48fc5af533a94da2a6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 24 16:26:31 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Feb 24 21:22:23 2021 +0100

    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 at redhat.com>

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);
 


More information about the Libreoffice-commits mailing list