sc/source/core/data/column3.cxx |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 456e2353ef9ae4e1034d078e026187ce5382c54a
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu May 29 10:45:39 2014 +0100

    Resolves: fdo#79392 don't access after last row, when last row is max last 
row
    
    Change-Id: I06749af90bed6a43f3fb6b3b5ceb61d5fbbc7c02
    (cherry picked from commit a35d92197d850527bd294eb6197b5bf83109d5be)
    Reviewed-on: https://gerrit.libreoffice.org/9546
    Reviewed-by: Kohei Yoshida <libreoff...@kohei.us>
    Tested-by: Kohei Yoshida <libreoff...@kohei.us>

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index c7b157e..c311e37 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -236,19 +236,22 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
 
     // Check if there are any cells below the end row that will get shifted.
     bool bShiftCells = false;
-    aPos = maCells.position(itCell, nEndRow+1);
-    itCell = aPos.first;
-    if (itCell->type == sc::element_type_empty)
+    if (nEndRow < MAXROWCOUNT-1) //only makes sense to do this if there *is* a 
row after the end row
     {
-        // This block is empty. See if there is any block that follows.
-        sc::CellStoreType::iterator itTest = itCell;
-        ++itTest;
-        if (itTest != maCells.end())
-            // Non-empty block follows -> cells that will get shifted.
+        aPos = maCells.position(itCell, nEndRow+1);
+        itCell = aPos.first;
+        if (itCell->type == sc::element_type_empty)
+        {
+            // This block is empty. See if there is any block that follows.
+            sc::CellStoreType::iterator itTest = itCell;
+            ++itTest;
+            if (itTest != maCells.end())
+                // Non-empty block follows -> cells that will get shifted.
+                bShiftCells = true;
+        }
+        else
             bShiftCells = true;
     }
-    else
-        bShiftCells = true;
 
     sc::SingleColumnSpanSet aNonEmptySpans;
     if (bShiftCells)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to