[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 5 19:50:17 UTC 2020
sw/source/uibase/utlui/glbltree.cxx | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
New commits:
commit 2fde5d4a7b778ab7f7a4945f04882b3dbe2b8a8e
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Mar 5 14:37:32 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Mar 5 20:49:42 2020 +0100
result of LastVisible is never used
bMove is set to true on this branch, so the result of LastVisible
is not used in the !bMove branch which is the only place _pContent
gets dereferenced
Change-Id: I167131220e3381d8f4458c3f1c349ea59f224869
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90018
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 5192f7f0e5c5..5399547e0f97 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1267,13 +1267,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen
if ( !nFiles )
return;
- bool bMove = false;
- if ( !_pContent )
- {
- SvTreeListEntry* pLast = LastVisible();
- _pContent = static_cast<SwGlblDocContent*>(pLast->GetUserData());
- bMove = true;
- }
+ bool bMove = _pContent == nullptr;;
sal_uLong nEntryCount = GetEntryCount();
const OUString* pFileNames = _rFiles.getConstArray();
SwWrtShell& rSh = GetParentWindow()->GetCreateView()->GetWrtShell();
@@ -1281,7 +1275,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen
// after insertion of the first new content the 'pCont' parameter becomes invalid
// find the index of the 'anchor' content to always use a current anchor content
size_t nAnchorContent = m_pSwGlblDocContents->size() - 1;
- if ( !bMove )
+ if (!bMove)
{
for (size_t nContent = 0; nContent < m_pSwGlblDocContents->size();
++nContent)
@@ -1341,7 +1335,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen
rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData );
}
- if ( bMove )
+ if (bMove)
{
Update( false );
rSh.MoveGlobalDocContent(
More information about the Libreoffice-commits
mailing list