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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 3 11:14:44 UTC 2018


 sw/source/core/edit/edglbldc.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5967bae717c83a44d865558373acc08ee365de22
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 3 11:32:02 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Sep 3 13:14:24 2018 +0200

    fix bug in SwEditShell::GetGlobalDocContent
    
    ever since
       commit 84a3db80b4fd66c6854b3135b5f69b61fd828e62
       Date:   Mon Sep 18 23:08:29 2000 +0000
       initial import
    
    where it could insert an uninitialised pointer into the
    SwGlblDocContents sorted vector
    
    Change-Id: Id58778444593c39b5f80bac3a6dab8e14404030a
    Reviewed-on: https://gerrit.libreoffice.org/59932
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx
index ec77cb82287a..e2f4dd71f7bf 100644
--- a/sw/source/core/edit/edglbldc.cxx
+++ b/sw/source/core/edit/edglbldc.cxx
@@ -67,7 +67,7 @@ void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
         const SwSection* pSect = rSectFormats[ --n ]->GetGlobalDocSection();
         if( pSect )
         {
-            SwGlblDocContent* pNew;
+            SwGlblDocContent* pNew = nullptr;
             switch( pSect->GetType() )
             {
             case TOX_HEADER_SECTION:
@@ -81,7 +81,7 @@ void SwEditShell::GetGlobalDocContent( SwGlblDocContents& rArr ) const
                 pNew = new SwGlblDocContent( pSect );
                 break;
             }
-            if( !rArr.insert( pNew ).second )
+            if( pNew && !rArr.insert( pNew ).second )
                 delete pNew;
         }
     }


More information about the Libreoffice-commits mailing list