Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Please review the attached patch which fixes

https://bugs.freedesktop.org/show_bug.cgi?id=37458

This is for 3.4.1, so I only need one review.

Thanks a lot,

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida@novell.com>
From 1f26bb6e3effeccffee1bec1a0e730e0e952f3a8 Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kyoshida@novell.com>
Date: Thu, 26 May 2011 00:05:32 -0400
Subject: [PATCH] fdo#37458: Prevent crash on named range deletion.

Simple NULL pointer checks will prevent crashes....
---
 sc/source/core/data/dpobject.cxx |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

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 );
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.