[Libreoffice-commits] core.git: sc/source

Caolán McNamara caolanm at redhat.com
Sat Jan 14 11:33:49 UTC 2017


 sc/source/core/data/dptabres.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 08a8174d17fa32f709546e63c26fcf8a7c4f8255
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 14 11:24:21 2017 +0000

    coverity#1398581 Dereference after null check
    
    and
    
    coverity#1398582 Dereference after null check
    
    Change-Id: I6cbf11c30aac3e9dd7eb0727063a79369fb3e059

diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index b62c88b..a98d800 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -2609,11 +2609,11 @@ void ScDPDataMember::UpdateRunningTotals(
                                 {
                                     double nTotal;
                                     if ( eRefType == sheet::DataPilotFieldReferenceType::ROW_PERCENTAGE )
-                                        nTotal = pRowTotalData->GetAuxiliary();
+                                        nTotal = pRowTotalData ? pRowTotalData->GetAuxiliary() : 0.0;
                                     else if ( eRefType == sheet::DataPilotFieldReferenceType::COLUMN_PERCENTAGE )
-                                        nTotal = pColTotalData->GetAuxiliary();
+                                        nTotal = pColTotalData ? pColTotalData->GetAuxiliary() : 0.0;
                                     else
-                                        nTotal = pGrandTotalData->GetAuxiliary();
+                                        nTotal = pGrandTotalData ? pGrandTotalData->GetAuxiliary() : 0.0;
 
                                     if ( nTotal == 0.0 )
                                         pAggData->SetError();
@@ -2623,9 +2623,9 @@ void ScDPDataMember::UpdateRunningTotals(
                                 break;
                             case sheet::DataPilotFieldReferenceType::INDEX:
                                 {
-                                    double nColTotal = pColTotalData->GetAuxiliary();
-                                    double nRowTotal = pRowTotalData->GetAuxiliary();
-                                    double nGrandTotal = pGrandTotalData->GetAuxiliary();
+                                    double nColTotal = pColTotalData ? pColTotalData->GetAuxiliary() : 0.0;
+                                    double nRowTotal = pRowTotalData ? pRowTotalData->GetAuxiliary() : 0.0;
+                                    double nGrandTotal = pGrandTotalData ? pGrandTotalData->GetAuxiliary() : 0.0;
                                     if ( nRowTotal == 0.0 || nColTotal == 0.0 )
                                         pAggData->SetError();
                                     else


More information about the Libreoffice-commits mailing list