diff options
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index fff2eeb18114..2f736785b503 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1852,11 +1852,13 @@ void VDataSeriesGroup::calculateYMinAndMaxForCategory( sal_Int32 nCategoryIndex , bool bSeparateStackingForDifferentSigns , double& rfMinimumY, double& rfMaximumY, sal_Int32 nAxisIndex ) { + assert(nCategoryIndex >= 0); + assert(nCategoryIndex < getPointCount()); + ::rtl::math::setInf(&rfMinimumY, false); ::rtl::math::setInf(&rfMaximumY, true); - sal_Int32 nPointCount = getPointCount();//necessary to create m_aListOfCachedYValues - if(nCategoryIndex<0 || nCategoryIndex>=nPointCount || m_aSeriesVector.empty()) + if(m_aSeriesVector.empty()) return; CachedYValues aCachedYValues = m_aListOfCachedYValues[nCategoryIndex][nAxisIndex]; @@ -1950,6 +1952,9 @@ void VDataSeriesGroup::calculateYMinAndMaxForCategoryRange( //iterate through the given categories if(nStartCategoryIndex<0) nStartCategoryIndex=0; + const sal_Int32 nPointCount = getPointCount();//necessary to create m_aListOfCachedYValues + if (nEndCategoryIndex >= nPointCount) + nEndCategoryIndex = nPointCount - 1; if(nEndCategoryIndex<0) nEndCategoryIndex=0; for( sal_Int32 nCatIndex = nStartCategoryIndex; nCatIndex <= nEndCategoryIndex; nCatIndex++ ) |