[Libreoffice-commits] core.git: Branch 'private/kohei/new-chart-type-skeleton' - chart2/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Mar 21 07:29:36 PDT 2014


 chart2/source/model/template/ChartTypeTemplate.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 34bd5659c138517cac53a34bdf55d5f63d0b33ca
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Mar 21 10:27:46 2014 -0400

    Let's be more defensive here by checking for null return objects.
    
    Change-Id: I5164e7d82f882ea9fe296a5a2df616d396d6726f

diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index 83e747e..748d40d 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;


More information about the Libreoffice-commits mailing list