sw/source/core/layout/hffrm.cxx |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 67edb62a88f331d93ba3aa0741bd4ef734d56062
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Oct 11 19:57:55 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Oct 11 22:39:33 2020 +0200

    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 <caol...@redhat.com>

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() )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to