Kaydet (Commit) 325ecb1d authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Let's be more defensive here by checking for null return objects.

Change-Id: I5164e7d82f882ea9fe296a5a2df616d396d6726f
üst 6292dbc3
...@@ -337,7 +337,11 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate( ...@@ -337,7 +337,11 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
if( bResult ) if( bResult )
{ {
Sequence< Reference< XChartType > > aFormerlyUsedChartTypes; Sequence< Reference< XChartType > > aFormerlyUsedChartTypes;
const OUString aChartTypeToMatch( getChartTypeForNewSeries(aFormerlyUsedChartTypes)->getChartType()); Reference<XChartType> xOldCT = getChartTypeForNewSeries(aFormerlyUsedChartTypes);
if (!xOldCT.is())
return false;
const OUString aChartTypeToMatch = xOldCT->getChartType();
const sal_Int32 nDimensionToMatch = getDimension(); const sal_Int32 nDimensionToMatch = getDimension();
for( sal_Int32 nCooSysIdx=0; bResult && (nCooSysIdx < aCooSysSeq.getLength()); ++nCooSysIdx ) for( sal_Int32 nCooSysIdx=0; bResult && (nCooSysIdx < aCooSysSeq.getLength()); ++nCooSysIdx )
{ {
...@@ -348,6 +352,9 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate( ...@@ -348,6 +352,9 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes()); Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
for( sal_Int32 nCTIdx=0; bResult && (nCTIdx < aChartTypeSeq.getLength()); ++nCTIdx ) for( sal_Int32 nCTIdx=0; bResult && (nCTIdx < aChartTypeSeq.getLength()); ++nCTIdx )
{ {
if (!aChartTypeSeq[nCTIdx].is())
return false;
// match chart type // match chart type
bResult = bResult && aChartTypeSeq[nCTIdx]->getChartType().equals( aChartTypeToMatch ); bResult = bResult && aChartTypeSeq[nCTIdx]->getChartType().equals( aChartTypeToMatch );
bool bFound=false; bool bFound=false;
......
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