diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-21 10:27:46 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-24 22:24:50 -0400 |
commit | 325ecb1d0511c6c02d863eb760c2d0521f0b6c19 (patch) | |
tree | 88e98af0cac6445bffd265a851edebe6a37d0fdf /chart2/source/model | |
parent | 6292dbc3ef4067280290f2c7f95292e2791a15db (diff) |
Let's be more defensive here by checking for null return objects.
Change-Id: I5164e7d82f882ea9fe296a5a2df616d396d6726f
Diffstat (limited to 'chart2/source/model')
-rw-r--r-- | chart2/source/model/template/ChartTypeTemplate.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 83e747e773ec..748d40d2d38a 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -337,7 +337,11 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate( if( bResult ) { 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(); for( sal_Int32 nCooSysIdx=0; bResult && (nCooSysIdx < aCooSysSeq.getLength()); ++nCooSysIdx ) { @@ -348,6 +352,9 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate( Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes()); for( sal_Int32 nCTIdx=0; bResult && (nCTIdx < aChartTypeSeq.getLength()); ++nCTIdx ) { + if (!aChartTypeSeq[nCTIdx].is()) + return false; + // match chart type bResult = bResult && aChartTypeSeq[nCTIdx]->getChartType().equals( aChartTypeToMatch ); bool bFound=false; |