[Libreoffice-commits] core.git: sd/source

Norbert Thiebaud nthiebaud at gmail.com
Wed Jun 26 11:28:19 PDT 2013


 sd/source/ui/view/drawview.cxx |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit cf6adeaf1c7f765c83481cff0311b9817ac4cbc1
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Wed Jun 26 02:04:59 2013 -0500

    coverity#1027646 Dereference after null check
    
    Change-Id: Id1028f87a6dded7d2c27fe8d793342574d06e3f9
    Reviewed-on: https://gerrit.libreoffice.org/4528
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index 27c5ece..0a273fe 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;


More information about the Libreoffice-commits mailing list