summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-03 11:32:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-03 13:14:24 +0200
commit5967bae717c83a44d865558373acc08ee365de22 (patch)
tree7b781770a5126c3591ddb4d5674fa28f1be6474c
parent437d5d30422014c0a6def06e432a41e3f2e5c4c5 (diff)
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@collabora.co.uk>
-rw-r--r--sw/source/core/edit/edglbldc.cxx4
1 files changed, 2 insertions, 2 deletions
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;
}
}