summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/dbgui/PivotLayoutDialog.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 03a8db215c91..d7982a915c96 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -517,12 +517,16 @@ void ScPivotLayoutDialog::ApplyChanges()
{
const ScRange& rOldRange = pOldDPObj->GetOutRange();
+ ScDPObject *pDPObj = nullptr;
// FIXME: if the new range overlaps with the old one, the table actually doesn't move
// and shouldn't therefore be deleted
if ( ( ( rOldRange != aDestinationRange ) && !rOldRange.In( aDestinationRange ) )
|| bToNewSheet )
{
- ScDPObject *pDPObj = mpDocument->GetDPAtCursor( maPivotParameters.nCol, maPivotParameters.nRow, maPivotParameters.nTab);
+ mpDocument->GetDPAtCursor( maPivotParameters.nCol, maPivotParameters.nRow, maPivotParameters.nTab);
+ }
+ if (pDPObj)
+ {
ScDBDocFunc aFunc( *(mpViewData->GetDocShell() ));
aFunc.RemovePivotTable( *pDPObj, true, false);
mpViewData->GetView()->CursorPosChanged();