docnode/section: Use SvRef::get() instead of &*
Using &* can be problematic if the pointer is null. In this case it probably doesn’t matter, but using SvRef::get() is probably easier to understand anyway. This also paves the way for a later compiler plugin to check for this. Change-Id: I4de3949f3cac3a6cea448f878ca761a67750efc3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211846 Reviewed-by: Neil Roberts <nroberts@libreoffice.org> Tested-by: Jenkins
This commit is contained in:
@@ -1037,7 +1037,7 @@ static void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
|
||||
const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc().getIDocumentLinksAdministration().GetLinkManager().GetLinks();
|
||||
for ( auto n = rLnks.size(); n > 0; )
|
||||
{
|
||||
SwIntrnlSectRefLink* pSectLnk = dynamic_cast<SwIntrnlSectRefLink*>(&(*rLnks[ --n ]));
|
||||
SwIntrnlSectRefLink* pSectLnk = dynamic_cast<SwIntrnlSectRefLink*>(rLnks[ --n ].get());
|
||||
if ( pSectLnk && pSectLnk != pOwnLink &&
|
||||
pSectLnk->IsInRange( rSectNd.GetIndex(), rSectNd.EndOfSectionIndex() ) )
|
||||
{
|
||||
@@ -1071,7 +1071,7 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe
|
||||
const ::sfx2::SvBaseLinks& rLnks = rDoc.getIDocumentLinksAdministration().GetLinkManager().GetLinks();
|
||||
for( auto n = rLnks.size(); n; )
|
||||
{
|
||||
::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
|
||||
::sfx2::SvBaseLink* pLnk = rLnks[ --n ].get();
|
||||
if( pLnk == &rUpdLnk )
|
||||
continue;
|
||||
if( sfx2::SvBaseLinkObjectType::ClientFile != pLnk->GetObjType() )
|
||||
@@ -1091,11 +1091,11 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe
|
||||
if( n >= rLnks.size() && 0 != ( n = rLnks.size() ))
|
||||
--n;
|
||||
|
||||
if( n && pLnk != &(*rLnks[ n ]) )
|
||||
if( n && pLnk != rLnks[ n ].get() )
|
||||
{
|
||||
// Find - it can only precede it!
|
||||
while( n )
|
||||
if( pLnk == &(*rLnks[ --n ] ) )
|
||||
if( pLnk == rLnks[ --n ].get() )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user