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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Oct 21 09:31:23 UTC 2018


 sw/source/uibase/utlui/content.cxx |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

New commits:
commit 3f8a890dceb38427774abdcb0803d1f56f621c9d
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Oct 21 09:53:37 2018 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Oct 21 11:31:00 2018 +0200

    tdf#120703 (PVS): redundant nullptr checks, redundant assign
    
    V668 There is no sense in testing the 'pMember' pointer against null, as the
         memory was allocated using the 'new' operator. The exception will be
         generated in the case of memory allocation error.
    
    V519 The 'pObject' variable is assigned values twice successively. Perhaps
         this is a mistake. Check lines: 2876, 2877.
    
    Change-Id: I0c801c97e75da99bf39f7a14306e67abfb8a3d85
    Reviewed-on: https://gerrit.libreoffice.org/62123
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index a12b334dddc9..65e5d0395c40 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -740,10 +740,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
         case ContentTypeId::POSTIT:
         {
             nMemberCount = 0;
-            if(!pMember)
-                pMember.reset( new SwContentArr );
-            else
-                pMember->clear();
+            pMember->clear();
             SwPostItMgr* aMgr = pWrtShell->GetView().GetPostItMgr();
             if (aMgr)
             {
@@ -772,10 +769,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
         case ContentTypeId::DRAWOBJECT:
         {
             nMemberCount = 0;
-            if(!pMember)
-                pMember.reset( new SwContentArr );
-            else
-                pMember->clear();
+            pMember->clear();
 
             IDocumentDrawModelAccess& rIDDMA = pWrtShell->getIDocumentDrawModelAccess();
             SwDrawModel* pModel = rIDDMA.GetDrawModel();
@@ -2865,9 +2859,7 @@ void SwContentTree::KeyInput(const KeyEvent& rEvent)
                         const size_t nCount = pPage->GetObjCount();
                         bool hasObjectMarked = false;
 
-                        SdrObject* pObject = nullptr;
-                        pObject = GetDrawingObjectsByContent( pCnt );
-                        if( pObject )
+                        if (SdrObject* pObject = GetDrawingObjectsByContent(pCnt))
                         {
                             SdrPageView* pPV = pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
                             if( pPV )


More information about the Libreoffice-commits mailing list