summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-12-05 19:03:25 +0100
committerEike Rathke <erack@redhat.com>2014-12-05 19:06:29 +0100
commitc7b57c6c2b15a4b9f65dafb642e3f1da402e62ca (patch)
tree5bf1164ea65f6574eb5b564ea85efb7c915e529e
parent1e4235f8b2dc693b0fb1edade9db25a631bdbf94 (diff)
trim also empty leading column ranges, fdo#81501 follow-up
Change-Id: Ieaeea85149e4b6d263b112205bb17c155e2d12be
-rw-r--r--sc/source/core/data/table3.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 34561487d060..9a7de8f8391f 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1541,7 +1541,10 @@ void ScTable::Sort(
pUndo->mbUpdateRefs = bUpdateRefs;
}
- while (aSortParam.nCol2 > aSortParam.nCol1 && aCol[aSortParam.nCol2].IsEmptyBlock(aSortParam.nRow1, aSortParam.nRow2))
+ // Trim empty leading and trailing column ranges.
+ while (aSortParam.nCol1 < aSortParam.nCol2 && aCol[aSortParam.nCol1].IsEmptyBlock(aSortParam.nRow1, aSortParam.nRow2))
+ ++aSortParam.nCol1;
+ while (aSortParam.nCol1 < aSortParam.nCol2 && aCol[aSortParam.nCol2].IsEmptyBlock(aSortParam.nRow1, aSortParam.nRow2))
--aSortParam.nCol2;
if (rSortParam.bByRow)