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
commit6545200f2571e3198f2200ac2229d45afc8dac12 (patch)
tree4bc42b8317a0107563867fe6f08d8de0d3113001 /sc
parentb5543aa005827e331775dc06258ad77726de71ed (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 9bd907be742c..c9df5606f20f 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);