summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2013-06-26 02:04:59 -0500
committerMichael Stahl <mstahl@redhat.com>2013-06-26 18:28:00 +0000
commitcf6adeaf1c7f765c83481cff0311b9817ac4cbc1 (patch)
treec34222b004dfbf2ee9eb879c7022993f1282806c /sd
parent4d5fc661d37d03129b8054e494c03bed1933231d (diff)
coverity#1027646 Dereference after null check
Change-Id: Id1028f87a6dded7d2c27fe8d793342574d06e3f9 Reviewed-on: https://gerrit.libreoffice.org/4528 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/view/drawview.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index 27c5ece85bae..0a273fe35150 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -587,13 +587,20 @@ void DrawView::DeleteMarked()
Rectangle aRect( pObj->GetLogicRect() );
SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true );
- // Move the new PresObj to the position before the
- // object it will replace.
- pUndoManager->AddUndoAction(
- mrDoc.GetSdrUndoFactory().CreateUndoObjectOrdNum(
- *pNewObj,
- pNewObj->GetOrdNum(),
- pObj->GetOrdNum()));
+ // pUndoManager should not be NULL (see assert above)
+ // but since we have defensive code
+ // for it earlier and later in the function
+ // we might as well be consistant
+ if(pUndoManager)
+ {
+ // Move the new PresObj to the position before the
+ // object it will replace.
+ pUndoManager->AddUndoAction(
+ mrDoc.GetSdrUndoFactory().CreateUndoObjectOrdNum(
+ *pNewObj,
+ pNewObj->GetOrdNum(),
+ pObj->GetOrdNum()));
+ }
pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() );
bResetLayout = true;