summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-10-20 15:29:56 +0200
committerKohei Yoshida <kyoshida@novell.com>2010-10-20 15:33:02 +0200
commit167cff40a6bca04fc5e022919723a974f7a45d0b (patch)
tree89036a0f99c25c6ef168e2384b4a5e4efc687443 /sc
parent762458843f8b0fb426f1e702739d63b2d69f9575 (diff)
Fixed a crash on importing docs with database functions.
When iterating through an empty column via ScDBQueryDataIterator it caused segfalut. (fdo#30861)
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/dociter.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index f36a55bb4..b7d52cd3c 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -543,6 +543,10 @@ bool ScDBQueryDataIterator::DataAccessInternal::getCurrent(Value& rValue)
}
SCSIZE nCellCount = mpDoc->GetCellCount(nTab, nCol);
+ if (!nCellCount)
+ // No cells found in this column. Bail out.
+ return false;
+
SCROW nThisRow = ScDBQueryDataIterator::GetRowByColEntryIndex(*mpDoc, nTab, nCol, nColRow);
while ( (nColRow < nCellCount) && (nThisRow < nRow) )
nThisRow = ScDBQueryDataIterator::GetRowByColEntryIndex(*mpDoc, nTab, nCol, ++nColRow);