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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Oct 21 10:30:16 UTC 2018


 basic/source/uno/namecont.cxx |   39 +++++++++++++++------------------------
 1 file changed, 15 insertions(+), 24 deletions(-)

New commits:
commit 58abc74248509067e0160a7ff5d5709316f3e274
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Oct 21 10:53:13 2018 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Oct 21 12:29:53 2018 +0200

    tdf#120703 (PVS): redundant nullptr checks
    
    V668 There is no sense in testing the 'm_pScriptSubPackageIterator' pointer
         against null, as the memory was allocated using the 'new' operator. The
         exception will be generated in the case of memory allocation error.
    
    Change-Id: I15e635a6c9420ff444c5998dc0dbbf6f74ca6644
    Reviewed-on: https://gerrit.libreoffice.org/62126
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 6fd58bcdf08e..77ce160665d7 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -3355,15 +3355,12 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript
             m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
         }
 
-        if( m_pScriptSubPackageIterator != nullptr )
+        xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib );
+        if( !xScriptPackage.is() )
         {
-            xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib );
-            if( !xScriptPackage.is() )
-            {
-                delete m_pScriptSubPackageIterator;
-                m_pScriptSubPackageIterator = nullptr;
-                m_iUserPackage++;
-            }
+            delete m_pScriptSubPackageIterator;
+            m_pScriptSubPackageIterator = nullptr;
+            m_iUserPackage++;
         }
     }
 
@@ -3409,15 +3406,12 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
             m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
         }
 
-        if( m_pScriptSubPackageIterator != nullptr )
+        xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib );
+        if( !xScriptPackage.is() )
         {
-            xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib );
-            if( !xScriptPackage.is() )
-            {
-                delete m_pScriptSubPackageIterator;
-                m_pScriptSubPackageIterator = nullptr;
-                m_iSharedPackage++;
-            }
+            delete m_pScriptSubPackageIterator;
+            m_pScriptSubPackageIterator = nullptr;
+            m_iSharedPackage++;
         }
     }
 
@@ -3463,15 +3457,12 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
             m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
         }
 
-        if( m_pScriptSubPackageIterator != nullptr )
+        xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib );
+        if( !xScriptPackage.is() )
         {
-            xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib );
-            if( !xScriptPackage.is() )
-            {
-                delete m_pScriptSubPackageIterator;
-                m_pScriptSubPackageIterator = nullptr;
-                m_iBundledPackage++;
-            }
+            delete m_pScriptSubPackageIterator;
+            m_pScriptSubPackageIterator = nullptr;
+            m_iBundledPackage++;
         }
     }
 


More information about the Libreoffice-commits mailing list