summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-06-03 15:20:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-06-03 15:50:24 +0100
commit77df4faa4783df38383020a6236136a88eb51069 (patch)
tree4e47ffdacb079154ad4d2265b873d89d781b2914
parent8fbb45c978327a3047a84c59978a07bdc19a66dd (diff)
fix crash on export of ooo39845-7.sxw to .docx
only bump m_nFieldsInHyperlink if the field isn't erased from the stack Change-Id: Idb75d087f6fa3ce3cd399623d8ace1e7f3899b5c
-rw-r--r--sw/qa/extras/ooxmlexport/data/ooo39845-7.odtbin0 -> 14361 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx6
3 files changed, 10 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/ooo39845-7.odt b/sw/qa/extras/ooxmlexport/data/ooo39845-7.odt
new file mode 100644
index 000000000000..ee8d139359b4
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/ooo39845-7.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 5e1893708acd..f702fa9cfc2e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -677,6 +677,13 @@ DECLARE_OOXMLEXPORT_TEST(testOO34469, "ooo34469-1.odt")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", "2.9.2.Creating New files|outline");
}
+DECLARE_OOXMLEXPORT_TEST(testOO39845, "ooo39845-7.odt")
+{
+ if (xmlDocPtr pXmlDoc = parseExport())
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink[1]", "anchor", "Figure4|graphic");
+}
+
+
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 25eec02846e8..aecd1d1adac7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1058,9 +1058,6 @@ void DocxAttributeOutput::EndRun()
{
StartField_Impl( *pIt );
- if (m_startedHyperlink)
- ++m_nFieldsInHyperlink;
-
// Remove the field from the stack if only the start has to be written
// Unknown fields should be removed too
if ( !pIt->bClose || ( pIt->eType == ww::eUNKNOWN ) )
@@ -1069,6 +1066,9 @@ void DocxAttributeOutput::EndRun()
continue;
}
+ if (m_startedHyperlink)
+ ++m_nFieldsInHyperlink;
+
if ( m_pHyperlinkAttrList )
{
m_nFieldsInHyperlink++;