summaryrefslogtreecommitdiff
path: root/sc/source/core/data/table1.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/table1.cxx')
-rw-r--r--sc/source/core/data/table1.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 4c5be3efcda9..8457035c784a 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1123,8 +1123,10 @@ void ScTable::LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol
// Optimised loop for finding the bottom of the area, can be costly in large
// spreadsheets.
+ SCROW lastDataPos = 0;
for (SCCOL i=rStartCol; i<=rEndCol; i++)
- rEndRow = std::min(rEndRow, aCol[i].GetLastDataPos());
+ lastDataPos = std::max(lastDataPos, aCol[i].GetLastDataPos());
+ rEndRow = std::min(rEndRow, lastDataPos);
}
SCCOL ScTable::FindNextVisibleCol( SCCOL nCol, bool bRight ) const