summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTushar Bende <tushar.bende@synerzip.com>2013-11-14 20:04:23 +0530
committerCaolán McNamara <caolanm@redhat.com>2013-11-15 09:57:16 +0000
commit8f7c127c4be32a91052ea962aafd0af8a1645714 (patch)
tree5b0fb1bc9547dca1e735276f31126d1a7bb267ad
parent20075205724ede61c35bcbf4781e3f7bf5811a78 (diff)
Fix for LibreOffice crash during Document RoundTrip
Description: Some Documents were crashing LO During Roundtrip. This was because of setting wrong gridSpan value during export. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Change-Id: Ibcb6d4f00520500a98c16eb40dec3b052ad6b3f9 Reviewed-on: https://gerrit.libreoffice.org/6672 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/qa/extras/ooxmlexport/data/cell-grid-span.docxbin0 -> 14652 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx10
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx6
3 files changed, 15 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx b/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx
new file mode 100644
index 000000000000..de71d48188a2
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ce9a0a965aec..30f711547391 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1811,6 +1811,16 @@ DECLARE_OOXML_TEST(testTextBoxGradientAngle, "fdo65295.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int16( 45 * 10), aGradient8.Angle);
}
+DECLARE_OOXML_TEST(testCellGridSpan, "cell-grid-span.docx")
+{
+ // The problem was during export gridSpan value for 1st & 2nd cells for test document
+ // used to get set wrongly to 5 and 65532 respectively which was the reason for crash during save operation
+ // Varifying gridSpan element is not present in RoundTriped Document (As it's Default value is 1).
+ xmlDocPtr pXmlDoc = parseExport();
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:gridSpan",0);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:gridSpan",0);
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index c75de62d7a46..18d489689995 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -651,7 +651,11 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow,
SwWriteTableCol aSrchCol( nCPos );
SwWriteTableCols::const_iterator it = aCols.find( &aSrchCol );
OSL_ENSURE( it != aCols.end(), "missing column" );
- nCol = it - aCols.begin();
+ if(it != aCols.end())
+ {
+ // if find fails for some nCPos value then it used to set nCol value with size of aCols.
+ nCol = it - aCols.begin();
+ }
if( !ShouldExpandSub( pBox, bSubExpanded, nDepth ) )
{