sw/source/core/bastyp/swcache.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 900f47904517878530b88776a09a3268f4cc1a84
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat Aug 31 16:32:41 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat Aug 31 22:55:38 2024 +0200

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

diff --git a/sw/source/core/bastyp/swcache.cxx 
b/sw/source/core/bastyp/swcache.cxx
index 531ce2de4449..484850294193 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -301,17 +301,18 @@ void SwCache::DeleteObj( SwCacheObj *pObj )
         // Shrink if possible.To do so we need enough free positions.
         // Unpleasant side effect: positions will be moved and the owner of
         // these might not find them afterwards
-        for ( size_t i = 0; i < m_aCacheObjects.size(); ++i )
+        size_t i = 0;
+        while (i < m_aCacheObjects.size())
         {
             SwCacheObj *pTmpObj = m_aCacheObjects[i].get();
             if ( !pTmpObj )
             {
                 m_aCacheObjects.erase( m_aCacheObjects.begin() + i );
-                --i;
             }
             else
             {
                 pTmpObj->SetCachePos( i );
+                ++i;
             }
         }
         m_aFreePositions.clear();

Reply via email to