diff options
author | Eike Rathke <erack@redhat.com> | 2017-12-15 16:27:54 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-12-18 19:15:41 +0100 |
commit | ee872acfe6ae0e2fd59f2e9b5e3cecdccbae21c7 (patch) | |
tree | bc95bcc81e8471db1cb03421fde6f1dd82d47d49 /sc | |
parent | 385fe413094fa56278ce3a21fa42f091496962be (diff) |
Resolves: tdf#113537 don't keep nEndRow=MAXROW if data ends above
Change-Id: I186034cada9718c067fa4dc7f72e2ca55ac06f83
(cherry picked from commit fa100e0abc83b876ca18b4178c44fb1dfc452a5d)
Reviewed-on: https://gerrit.libreoffice.org/46566
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/dbdata.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 1f2e7703f271..6422c7c33c3f 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -625,7 +625,12 @@ void ScDBData::ExtendDataArea(ScDocument* pDoc) SCCOL nOldCol1 = nStartCol, nOldCol2 = nEndCol; SCROW nOldEndRow = nEndRow; pDoc->GetDataArea(nTable, nStartCol, nStartRow, nEndCol, nEndRow, false, true); - nEndRow = std::max(nEndRow, nOldEndRow); + // nOldEndRow==MAXROW may easily happen when selecting whole columns and + // setting an AutoFilter (i.e. creating an anonymous database-range). We + // certainly don't want to iterate over nearly a million empty cells, but + // keep only an intentionally user selected range. + if (nOldEndRow < MAXROW && nEndRow < nOldEndRow) + nEndRow = nOldEndRow; if (nStartCol != nOldCol1 || nEndCol != nOldCol2) { SAL_WARN_IF( !maTableColumnNames.empty(), "sc.core", "ScDBData::ExtendDataArea - invalidating column names/offsets"); |