summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-01-11 20:41:21 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-01-11 23:37:12 -0500
commit676c5a2a9235459a948eddf5bb93ebeb6c23dac3 (patch)
tree939c52e9a04de2cb84cc801e9268cffc203cd4f7
parent37cdf01c4e6de756c3ea3e05f9a648dc32c8e3d3 (diff)
Check this first before instantiating heap objects.
To prevent memory leak. Change-Id: Ia4a5bb3fbad8bdd5646bc92c405458b929b5f7da
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index cf962c22fb70..26071c0bfb9b 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1248,6 +1248,12 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
ScDocShellModificator aModificator( rDocShell );
WaitObject aWait( rDocShell.GetActiveDialogParent() );
+ ScRangeList aRanges;
+ aRanges.Append(pOldObj->GetOutRange());
+ aRanges.Append(pNewObj->GetOutRange().aStart); // at least one cell in the output position must be editable.
+ if (!isEditable(rDocShell, aRanges, bApi))
+ return false;
+
bool bDone = false;
bool bUndoSelf = false;
sal_uInt16 nErrId = 0;
@@ -1262,12 +1268,6 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
if (bRecord && !pDoc->IsUndoEnabled())
bRecord = false;
- ScRangeList aRanges;
- aRanges.Append(pOldObj->GetOutRange());
- aRanges.Append(pNewObj->GetOutRange().aStart); // at least one cell in the output position must be editable.
- if (!isEditable(rDocShell, aRanges, bApi))
- return false;
-
ScDPObject* pDestObj = NULL;
if ( !nErrId )
{