summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-05-26 00:05:32 -0400
committerMichael Meeks <michael.meeks@novell.com>2011-05-26 10:44:26 +0100
commit10feb42cc16b9a715e1d631941875f9aab17ae37 (patch)
treeb249a40e4fef305c04c640d7f0ecafe0385605d8
parent17ec3ef031415fa4ec1a80b9d2415c84e209034d (diff)
fdo#37458: Prevent crash on named range deletion.
Simple NULL pointer checks will prevent crashes....
-rw-r--r--sc/source/core/data/dpobject.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 85f02e2c4..472c451ea 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 );