[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed May 25 21:08:22 PDT 2011


 sc/source/core/data/dpobject.cxx |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 1f26bb6e3effeccffee1bec1a0e730e0e952f3a8
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu May 26 00:05:32 2011 -0400

    fdo#37458: Prevent crash on named range deletion.
    
    Simple NULL pointer checks will prevent crashes....

diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index d3c778a..c661a70 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -469,8 +469,11 @@ void ScDPObject::CreateObjects()
         {
             DBG_ASSERT( !pServDesc, "DPSource could not be created" );
             ScDPTableData* pData = GetTableData();
-            ScDPSource* pSource = new ScDPSource( pData );
-            xSource = pSource;
+            if (pData)
+            {
+                ScDPSource* pSource = new ScDPSource( pData );
+                xSource = pSource;
+            }
         }
 
         if (pSaveData)
@@ -1848,6 +1851,9 @@ sal_Bool ScDPObject::FillOldParam(ScPivotParam& rParam) const
 {
     ((ScDPObject*)this)->CreateObjects();		// xSource is needed for field numbers
 
+    if (!xSource.is())
+        return false;
+
     rParam.nCol = aOutRange.aStart.Col();
     rParam.nRow = aOutRange.aStart.Row();
     rParam.nTab = aOutRange.aStart.Tab();
@@ -1941,6 +1947,8 @@ sal_Bool ScDPObject::FillLabelData(ScPivotParam& rParam)
     rParam.maLabelArray.clear();
 
     ((ScDPObject*)this)->CreateObjects();
+    if (!xSource.is())
+        return false;
 
     uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
     uno::Reference<container::XIndexAccess> xDims = new ScNameToIndexAccess( xDimsName );


More information about the Libreoffice-commits mailing list