From 10b1fb083b3f66fb4099f84e94a1b4cd52ed1b06 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sat, 16 Jul 2016 01:43:11 +0200 Subject: Resolves: tdf#100764 check row when determining bounds for deleted range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression introduced with a2e591e26549294cdb07eb685d4069343404d898 for tdf#86502 Change-Id: I493c458faedccfd6e2ddf849073a52661ef2e4d0 (cherry picked from commit ab1b351840160655a9f0caedbb35e9fdf203c5a0) Reviewed-on: https://gerrit.libreoffice.org/27248 Reviewed-by: Caolán McNamara Reviewed-by: Eike Rathke Reviewed-by: Adolfo Jayme Barrientos Tested-by: Adolfo Jayme Barrientos --- sc/source/core/tool/token.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 76018e4f5136..fd390a47d6e6 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -4250,7 +4250,10 @@ void checkBounds( if (pDeletedRange && aAbs.aStart.Row() <= pDeletedRange->aStart.Row()) { SCROW nOffset = pDeletedRange->aStart.Row() - aAbs.aStart.Row(); - rBounds.push_back(rPos.Row()+nOffset); + SCROW nRow = rPos.Row() + nOffset; + // Unlike for rCheckRange, for pDeletedRange nRow can be anywhere>=0. + if (ValidRow(nRow)) + rBounds.push_back(nRow); } if (aAbs.aEnd.Row() >= rCheckRange.aEnd.Row()) @@ -4272,7 +4275,10 @@ void checkBounds( if (pDeletedRange && aAbs.aEnd.Row() >= pDeletedRange->aEnd.Row()) { SCROW nOffset = pDeletedRange->aEnd.Row() + 1 - aAbs.aStart.Row(); - rBounds.push_back(rPos.Row()+nOffset); + SCROW nRow = rPos.Row() + nOffset; + // Unlike for rCheckRange, for pDeletedRange nRow can be ~anywhere. + if (ValidRow(nRow)) + rBounds.push_back(nRow); } } -- cgit