Kaydet (Commit) 66095e38 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

fix crash on export of ooo34469-1.sxw to docx

Change-Id: I94a11bd24ccbc550c9fa555b1a0b5493ccd9f904
(cherry picked from commit 9d0c6308)
üst 9766dd91
...@@ -671,6 +671,12 @@ DECLARE_OOXMLEXPORT_TEST(testFixedDateFields, "fixed-date-field.docx") ...@@ -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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -1052,7 +1052,7 @@ void DocxAttributeOutput::EndRun() ...@@ -1052,7 +1052,7 @@ void DocxAttributeOutput::EndRun()
} }
// Write field starts // 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 // Add the fields starts for all but hyperlinks and TOCs
if ( pIt->bOpen && pIt->pField ) if ( pIt->bOpen && pIt->pField )
...@@ -1266,6 +1266,7 @@ void DocxAttributeOutput::EndRun() ...@@ -1266,6 +1266,7 @@ void DocxAttributeOutput::EndRun()
EndField_Impl( m_Fields.back( ) ); EndField_Impl( m_Fields.back( ) );
m_Fields.pop_back(); m_Fields.pop_back();
} }
m_nFieldsInHyperlink = 0;
m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_pSerializer->endElementNS( XML_w, XML_hyperlink );
m_startedHyperlink = false; m_startedHyperlink = false;
...@@ -1274,12 +1275,15 @@ void DocxAttributeOutput::EndRun() ...@@ -1274,12 +1275,15 @@ void DocxAttributeOutput::EndRun()
m_closeHyperlinkInThisRun = false; m_closeHyperlinkInThisRun = false;
} }
if(!m_startedHyperlink) if (!m_startedHyperlink)
{
while ( m_Fields.begin() != m_Fields.end() ) while ( m_Fields.begin() != m_Fields.end() )
{ {
EndField_Impl( m_Fields.front( ) ); EndField_Impl( m_Fields.front( ) );
m_Fields.erase( m_Fields.begin( ) ); m_Fields.erase( m_Fields.begin( ) );
} }
m_nFieldsInHyperlink = 0;
}
} }
void DocxAttributeOutput::DoWriteBookmarks() void DocxAttributeOutput::DoWriteBookmarks()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment