From 2ce227a7642647267c982909a8b3175d22c58b74 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 4 Feb 2016 09:17:42 +0000 Subject: coverity#1351755 Dereference null return value Change-Id: I144a2c498763534b8aff604bdb3440180ac0f2ff --- sc/source/ui/dbgui/PivotLayoutDialog.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sc') 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(); -- cgit