Kaydet (Commit) 599c06ac authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Check the return value for negative index, to prevent crash.

Also, use at(index) when unsure about boundary condition.  That makes
it easier to detect where illegal memory access is being done.
üst fe01a68e
......@@ -807,7 +807,7 @@ SCROW ScDPCache::GetRowCount() const
const ScDPCache::DataListType& ScDPCache::GetDimMemberValues(SCCOL nDim) const
{
OSL_ENSURE( nDim>=0 && nDim < mnColumnCount ," nDim < mnColumnCount ");
return maFields[nDim].maItems;
return maFields.at(nDim).maItems;
}
sal_uLong ScDPCache::GetNumberFormat( long nDim ) const
......
......@@ -395,12 +395,15 @@ void ScDPSaveGroupDimension::AddToData( ScDPGroupTableData& rData ) const
void ScDPSaveGroupDimension::AddToCache(ScDPCache& rCache) const
{
long nSourceDim = rCache.GetDimensionIndex(aSourceDim);
if (nSourceDim < 0)
return;
long nDim = rCache.AppendGroupField();
SvNumberFormatter* pFormatter = rCache.GetDoc()->GetFormatTable();
if (nDatePart)
{
long nSourceDim = rCache.GetDimensionIndex(aSourceDim);
fillDateGroupDimension(rCache, aDateInfo, nSourceDim, nDim, nDatePart, pFormatter);
return;
}
......@@ -416,7 +419,6 @@ void ScDPSaveGroupDimension::AddToCache(ScDPCache& rCache) const
}
}
long nSourceDim = rCache.GetDimensionIndex(aSourceDim);
const ScDPCache::DataListType& rItems = rCache.GetDimMemberValues(nSourceDim);
{
ScDPCache::DataListType::const_iterator it = rItems.begin(), itEnd = rItems.end();
......@@ -466,6 +468,9 @@ void ScDPSaveNumGroupDimension::AddToData( ScDPGroupTableData& rData ) const
void ScDPSaveNumGroupDimension::AddToCache(ScDPCache& rCache) const
{
long nDim = rCache.GetDimensionIndex(aDimensionName);
if (nDim < 0)
return;
if (aDateInfo.mbEnable)
{
// Date grouping
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment