summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/data/dociter.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 92c7cbd2bfef..187a327206ae 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -568,7 +568,11 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue)
SCROW nThisRow = ScDBQueryDataIterator::GetRowByColEntryIndex(*mpDoc, nTab, nCol, nColRow);
while ( (nColRow < nCellCount) && (nThisRow < nRow) )
- nThisRow = ScDBQueryDataIterator::GetRowByColEntryIndex(*mpDoc, nTab, nCol, ++nColRow);
+ {
+ ++nColRow;
+ if(nColRow < nCellCount)
+ nThisRow = ScDBQueryDataIterator::GetRowByColEntryIndex(*mpDoc, nTab, nCol, nColRow);
+ }
if ( nColRow < nCellCount && nThisRow <= mpParam->nRow2 )
{