[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed May 4 12:31:04 PDT 2011


 sc/source/core/data/conditio.cxx |   18 +++++++++++++-----
 sc/source/ui/view/viewfunc.cxx   |    9 ++++++---
 2 files changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 6cae0836410f5e72ecfeb934aa886353417e6d38
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed May 4 15:29:53 2011 -0400

    fdo#36849: Assume that the range list member may be NULL.

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 6f9fda7..642c39b 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1270,7 +1270,8 @@ ScConditionalFormat::ScConditionalFormat(const ScConditionalFormat& r) :
     pAreas( NULL ),
     nKey( r.nKey ),
     ppEntries( NULL ),
-    nEntryCount( r.nEntryCount )
+    nEntryCount( r.nEntryCount ),
+    pRanges( NULL )
 {
     if (nEntryCount)
     {
@@ -1281,7 +1282,8 @@ ScConditionalFormat::ScConditionalFormat(const ScConditionalFormat& r) :
             ppEntries[i]->SetParent(this);
         }
     }
-    pRanges = new ScRangeList( *r.pRanges );
+    if (r.pRanges)
+        pRanges = new ScRangeList( *r.pRanges );
 }
 
 ScConditionalFormat* ScConditionalFormat::Clone(ScDocument* pNewDoc) const
@@ -1320,10 +1322,16 @@ sal_Bool ScConditionalFormat::EqualEntries( const ScConditionalFormat& r ) const
         if ( ! (*ppEntries[i] == *r.ppEntries[i]) )
             return false;
 
-    if( *pRanges != *r.pRanges )
-        return false;
+    if (pRanges)
+    {
+        if (r.pRanges)
+            return *pRanges == *r.pRanges;
+        else
+            return false;
+    }
 
-    return true;
+    // pRanges is NULL, which means r.pRanges must be NULL.
+    return r.pRanges.Is() == false;
 }
 
 void ScConditionalFormat::AddRangeInfo( const ScRangeListRef& rRanges )
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index e575ef3..85f7b06 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -97,10 +97,13 @@ static void lcl_PostRepaintCondFormat( const ScConditionalFormat *pCondFmt, ScDo
 {
     if( pCondFmt )
     {
-        const ScRangeListRef& aRanges = pCondFmt->GetRangeInfo();
-        size_t nCount = aRanges->size();
+        const ScRangeListRef& xRanges = pCondFmt->GetRangeInfo();
+        if (!xRanges)
+            return;
+
+        size_t nCount = xRanges->size();
         for( size_t n = 0 ; n < nCount; n++ )
-            pDocSh->PostPaint( *((*aRanges)[n]), PAINT_ALL );
+            pDocSh->PostPaint( *((*xRanges)[n]), PAINT_ALL );
     }
 }
 


More information about the Libreoffice-commits mailing list