summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-08-30 21:17:32 +0200
committerAndras Timar <andras.timar@collabora.com>2016-09-01 12:13:41 +0200
commitdde63e0aee5361e716475a6394d8b9977ad64ae6 (patch)
tree96d15d36141218e81dfcbf3c8ce0241e5cec4e3e
parente07e27ed1dc9e38dc5faed4aae2d47a5eb462dda (diff)
Revert "fftester: non-contiguous cells"
This reverts commit 9accbfa0a52433cf03fe186fc69334d387981eb9. ... and the code change of "avoid crashing on load of fdo54724-1.rtf" commit 4ee3eabd0f058b26544c84b2b5aaf5478d921817. It's much simpler to detect early in convertToTable that there is a row with no cells in it, which should not be allowed. Change-Id: Iff6d235b29514edd57cc55addeefb24242595d88 (cherry picked from commit dc83b3ae470914dbcb08fe1f0a4a4e1a1d3d8e19) Reviewed-on: https://gerrit.libreoffice.org/28512 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 217640264a62bd78b153b131b2cd158d4f8da620) Reviewed-on: https://gerrit.libreoffice.org/28539 (cherry picked from commit ad95040240bb8fe1fe56c6143cffcebf51b8b96f)
-rw-r--r--sw/qa/core/data/rtf/fail/table-1.rtfbin0 -> 849 bytes
-rw-r--r--sw/source/core/unocore/unotext.cxx23
2 files changed, 13 insertions, 10 deletions
diff --git a/sw/qa/core/data/rtf/fail/table-1.rtf b/sw/qa/core/data/rtf/fail/table-1.rtf
new file mode 100644
index 000000000000..c333a1037887
--- /dev/null
+++ b/sw/qa/core/data/rtf/fail/table-1.rtf
Binary files differ
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 08213898f90b..454dda669c5b 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2236,20 +2236,23 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
pTableRanges[nRow].getConstArray();
const sal_Int32 nCells(pTableRanges[nRow].getLength());
+ if (0 == nCells) // this would lead to no pLastCell below
+ { // and make it impossible to detect node gaps
+ bExcept = true;
+ break;
+ }
+
for (sal_Int32 nCell = 0; nCell < nCells; ++nCell)
{
- SwNodeRange *pLastCell;
- if (nCell == 0 && nRow == 0)
- {
- pLastCell = nullptr;
- }
- else
- {
- std::vector<SwNodeRange>& rRowOfPrevCell = nCell ? aRowNodes : *aTableNodes.rbegin();
- pLastCell = !rRowOfPrevCell.empty() ? &*rRowOfPrevCell.rbegin() : nullptr;
- }
+ SwNodeRange *const pLastCell(
+ (nCell == 0)
+ ? ((nRow == 0)
+ ? nullptr
+ : &*aTableNodes.rbegin()->rbegin())
+ : &*aRowNodes.rbegin());
m_pImpl->ConvertCell(pRow[nCell], aRowNodes, pLastCell, bExcept);
}
+ assert(bExcept || !aRowNodes.empty());
aTableNodes.push_back(aRowNodes);
}