sw/source/core/unocore/unotext.cxx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
New commits: commit 217640264a62bd78b153b131b2cd158d4f8da620 Author: Michael Stahl <mst...@redhat.com> Date: Tue Aug 30 21:17:32 2016 +0200 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 <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index add72db..b402d86 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); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits