From cf6adeaf1c7f765c83481cff0311b9817ac4cbc1 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Wed, 26 Jun 2013 02:04:59 -0500 Subject: coverity#1027646 Dereference after null check Change-Id: Id1028f87a6dded7d2c27fe8d793342574d06e3f9 Reviewed-on: https://gerrit.libreoffice.org/4528 Reviewed-by: Michael Stahl Tested-by: Michael Stahl --- sd/source/ui/view/drawview.cxx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'sd') 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; -- cgit