diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-10-11 19:57:55 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-10-11 22:39:33 +0200 |
commit | 67edb62a88f331d93ba3aa0741bd4ef734d56062 (patch) | |
tree | 48b308370e838214c58d18fa21b4c4b7de7ea9a7 | |
parent | 26637a22f4cb6112b6ae19e36c3ada6711a18579 (diff) |
DelFlys is never passed nullptrs
Change-Id: Id6496b020dbdec9005eb4326a2397dcc1dee70bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104193
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/core/layout/hffrm.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 50fc4e1b729f..79132b2c68c3 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -656,17 +656,17 @@ bool SwHeadFootFrame::GetEatSpacing() const return pFormat->GetHeaderAndFooterEatSpacing().GetValue(); } -static void DelFlys( SwLayoutFrame const *pFrame, SwPageFrame *pPage ) +static void DelFlys( const SwLayoutFrame& rFrame, SwPageFrame &rPage) { size_t i = 0; - while ( pPage->GetSortedObjs() && - pPage->GetSortedObjs()->size() && - i < pPage->GetSortedObjs()->size() ) + while ( rPage.GetSortedObjs() && + rPage.GetSortedObjs()->size() && + i < rPage.GetSortedObjs()->size() ) { - SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i]; + SwAnchoredObject* pObj = (*rPage.GetSortedObjs())[i]; if (SwFlyFrame* pFlyFrame = dynamic_cast<SwFlyFrame*>(pObj)) { - if ( pFrame->IsAnLower( pFlyFrame ) ) + if (rFrame.IsAnLower(pFlyFrame)) { SwFrame::DestroyFrame(pFlyFrame); // Do not increment index, in this case @@ -700,7 +700,7 @@ void SwPageFrame::PrepareHeader() if ( pLay->IsHeaderFrame() ) { SwLayoutFrame *pDel = pLay; pLay = static_cast<SwLayoutFrame*>(pLay->GetNext()); - ::DelFlys( pDel, this ); + ::DelFlys(*pDel, *this); pDel->Cut(); SwFrame::DestroyFrame(pDel); } @@ -712,7 +712,7 @@ void SwPageFrame::PrepareHeader() } else if (pLay->IsHeaderFrame()) { // Remove header if present. - ::DelFlys( pLay, this ); + ::DelFlys(*pLay, *this); pLay->Cut(); SwFrame::DestroyFrame(pLay); } @@ -742,7 +742,7 @@ void SwPageFrame::PrepareFooter() if ( pLay->IsFooterFrame() ) { - ::DelFlys( pLay, this ); + ::DelFlys(*pLay, *this); pLay->Cut(); SwFrame::DestroyFrame(pLay); } @@ -752,8 +752,9 @@ void SwPageFrame::PrepareFooter() ::RegistFlys( this, pF ); } else if ( pLay->IsFooterFrame() ) - { // Remove footer if already present - ::DelFlys( pLay, this ); + { + // Remove footer if already present + ::DelFlys(*pLay, *this); SwViewShell *pShell; if ( pLay->GetPrev() && nullptr != (pShell = getRootFrame()->GetCurrShell()) && pShell->VisArea().HasArea() ) |