summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-08-30 21:17:32 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-31 07:17:40 +0000
commit217640264a62bd78b153b131b2cd158d4f8da620 (patch)
tree0e54fa84d0064f8e17dea4bd5181b44fedd86d1a
parent7f6770fac8787203220cd73246ffc058a1b14d00 (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>
-rw-r--r--sw/source/core/unocore/unotext.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index add72dba4218..b402d8690cd0 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2230,20 +2230,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);
}