sw/source/core/docnode/ndsect.cxx |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

New commits:
commit b93c179b44e8b76e036e6fba560325c5cceb7103
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Aug 15 21:32:21 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Aug 21 22:53:58 2024 +0200

    cid#1608491 silence Overflowed constant
    
    Change-Id: Id0f2c3b40cf0282b393b6d076497dc390708fa75
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172220
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/docnode/ndsect.cxx 
b/sw/source/core/docnode/ndsect.cxx
index 7480279c9194..6a1f091b7c22 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -736,21 +736,25 @@ void sw_DeleteFootnote( SwSectionNode *pNd, SwNodeOffset 
nStt, SwNodeOffset nEnd
 
     size_t nPos = 0;
     rFootnoteArr.SeekEntry( *pNd, &nPos );
-    SwTextFootnote* pSrch;
 
     // Delete all succeeding Footnotes
-    while( nPos < rFootnoteArr.size() &&
-        SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) <= nEnd )
+    while (nPos < rFootnoteArr.size())
     {
+        SwTextFootnote* pSrch = rFootnoteArr[nPos];
+        if (SwTextFootnote_GetIndex(pSrch) > nEnd)
+            break;
         // If the Nodes are not deleted, they need to deregister at the Pages
         // (delete Frames) or else they will remain there (Undo does not 
delete them!)
         pSrch->DelFrames(nullptr);
         ++nPos;
     }
 
-    while( nPos-- &&
-        SwTextFootnote_GetIndex( (pSrch = rFootnoteArr[ nPos ]) ) >= nStt )
+    while (nPos > 0)
     {
+        nPos--;
+        SwTextFootnote* pSrch = rFootnoteArr[nPos];
+        if (SwTextFootnote_GetIndex(pSrch) < nStt)
+            break;
         // If the Nodes are not deleted, they need to deregister at the Pages
         // (delete Frames) or else they will remain there (Undo does not 
delete them!)
         pSrch->DelFrames(nullptr);

Reply via email to