Kaydet (Commit) 74dddd8b authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#104162 DOCX import: fix crash on <w:hideMark/> in a comment table

sw comments are handled by editeng, so tables in comments aren't
imported. That means lcl_emptyRow() may get a row where the first cell's
start is an empty reference, so handle that case.

Change-Id: I43e286314143934c20e6cbbd656d32883b6b2efe
üst 9fa5439c
......@@ -189,6 +189,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf99227, "tdf99227.docx")
assertXPath(pXmlDoc, "//w:footnote[3]/w:p/w:r[5]/w:drawing", 1);
}
DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx")
{
// This crashed: the comment field contained a table with a <w:hideMark/>.
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XElementAccess> xTextFields(xTextFieldsSupplier->getTextFields());
CPPUNIT_ASSERT(xTextFields->hasElements());
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -896,6 +896,14 @@ bool lcl_emptyRow(std::vector<RowSequence_t>& rTableRanges, sal_Int32 nRow)
return false;
}
if (!rRowSeq[0][0].is())
{
// This can happen when we can't import the table, e.g. we're inside a
// comment.
SAL_WARN("writerfilter.dmapper", "rRowSeq[0][0] is an empty reference");
return false;
}
uno::Reference<text::XTextRangeCompare> xTextRangeCompare(rRowSeq[0][0]->getText(), uno::UNO_QUERY);
try
{
......
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