diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-03 10:20:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-03 10:47:58 +0100 |
commit | 9d0c6308be5fb086e51cb8b4b0652f3d6184fd3c (patch) | |
tree | 14961003848ca3583aead3d3f41d84929c91f57a /sw | |
parent | c0b70ec34d5e056bb92a66cbf83838923cb41fee (diff) |
fix crash on export of ooo34469-1.sxw to docx
Change-Id: I94a11bd24ccbc550c9fa555b1a0b5493ccd9f904
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/ooo34469-1.odt | bin | 0 -> 16812 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 8 |
3 files changed, 12 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/ooo34469-1.odt b/sw/qa/extras/ooxmlexport/data/ooo34469-1.odt Binary files differnew file mode 100644 index 000000000000..7cf031fb2fcd --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/ooo34469-1.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 9121588c9d3f..5e1893708acd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -671,6 +671,12 @@ DECLARE_OOXMLEXPORT_TEST(testFixedDateFields, "fixed-date-field.docx") } } +DECLARE_OOXMLEXPORT_TEST(testOO34469, "ooo34469-1.odt") +{ + if (xmlDocPtr pXmlDoc = parseExport()) + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", "2.9.2.Creating New files|outline"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 16068b00f912..25eec02846e8 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1051,7 +1051,7 @@ void DocxAttributeOutput::EndRun() } // Write field starts - for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); ) + for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin() + nFieldsInPrevHyperlink; pIt != m_Fields.end(); ) { // Add the fields starts for all but hyperlinks and TOCs if ( pIt->bOpen && pIt->pField ) @@ -1265,6 +1265,7 @@ void DocxAttributeOutput::EndRun() EndField_Impl( m_Fields.back( ) ); m_Fields.pop_back(); } + m_nFieldsInHyperlink = 0; m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_startedHyperlink = false; @@ -1273,12 +1274,15 @@ void DocxAttributeOutput::EndRun() m_closeHyperlinkInThisRun = false; } - if(!m_startedHyperlink) + if (!m_startedHyperlink) + { while ( m_Fields.begin() != m_Fields.end() ) { EndField_Impl( m_Fields.front( ) ); m_Fields.erase( m_Fields.begin( ) ); } + m_nFieldsInHyperlink = 0; + } } void DocxAttributeOutput::DoWriteBookmarks() |