sw/source/core/doc/acmplwrd.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 37896449768b5dd08b0251385102d7caa33059af
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Sep 11 09:46:38 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Sep 11 17:17:20 2024 +0200

    cid#1607383 silence Overflowed constant
    
    Change-Id: I61b233714e613128d84bb19539727ac5a620a425
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173192
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index 38011750bd29..09ce4abf4ad3 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -326,7 +326,9 @@ void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n )
     // Do you really want to remove all words that are less than the minWrdLen?
     if( n < m_nMinWordLen )
     {
-        for (size_t nPos = 0; nPos < m_WordList.size(); ++nPos)
+        size_t nPos = 0;
+        while (nPos < m_WordList.size())
+        {
             if (m_WordList[ nPos ]->GetAutoCompleteString().getLength() < n)
             {
                 SwAutoCompleteString *const pDel =
@@ -336,9 +338,11 @@ void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n )
                 SwAutoCompleteStringPtrDeque::iterator it = std::find( 
m_aLRUList.begin(), m_aLRUList.end(), pDel );
                 OSL_ENSURE( m_aLRUList.end() != it, "String not found" );
                 m_aLRUList.erase( it );
-                --nPos;
                 delete pDel;
+                continue;
             }
+            ++nPos;
+        }
     }
 
     m_nMinWordLen = n;

Reply via email to