sw/qa/core/data/rtf/fail/table-1.rtf |binary sw/source/core/docnode/ndtbl.cxx | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
New commits: commit 9accbfa0a52433cf03fe186fc69334d387981eb9 Author: Caolán McNamara <[email protected]> Date: Tue Aug 30 10:20:33 2016 +0100 fftester: non-contiguous cells Change-Id: I1bf57f6e365b9e99a1893b5333e043ac6bc7b476 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 0000000..c333a10 Binary files /dev/null and b/sw/qa/core/data/rtf/fail/table-1.rtf differ diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 0abfc39..216070e 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1181,6 +1181,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > ++aRg.aEnd; } + bool bFailure = false; { // TODO: this is not Undo-able - only good enough for file import @@ -1188,11 +1189,17 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > SwNodeIndex const prev(rTableNodes.begin()->begin()->aStart, -1); SwNodeIndex const* pPrev(&prev); // pPrev could point to non-textnode now - for (auto row = rTableNodes.begin(); row != rTableNodes.end(); ++row) + for (auto row = rTableNodes.begin(); row != rTableNodes.end() && !bFailure; ++row) { for (auto cell = row->begin(); cell != row->end(); ++cell) { - assert(SwNodeIndex(*pPrev, +1) == cell->aStart); + bFailure = (SwNodeIndex(*pPrev, +1) != cell->aStart); + if (bFailure) + { + SAL_WARN("sw.core", "cell start is not directly after previous cell end"); + break; + } + SwPaM pam(cell->aStart, 0, *pPrev, (pPrev->GetNode().IsContentNode()) ? pPrev->GetNode().GetContentNode()->Len() : 0); @@ -1212,6 +1219,9 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > GetIDocumentUndoRedo().DoUndo(bUndo); + if (bFailure) + return nullptr; + // Create the Box/Line/Table construct SwTableBoxFormat* pBoxFormat = MakeTableBoxFormat(); SwTableLineFormat* pLineFormat = MakeTableLineFormat();
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
