Fixed a crash on importing docs with database functions.

When iterating through an empty column via ScDBQueryDataIterator it
caused segfalut. (fdo#30861)
This commit is contained in:
Kohei Yoshida 2010-10-20 15:29:56 +02:00
parent b5543aa005
commit 6545200f25

View file

@ -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);