From b8ef51bc0130f2832b86214dc6ce6315faae325c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 17 Sep 2024 10:24:33 +0100 Subject: [PATCH] cid#1608322 silence Overflowed constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I23229d2bb29c926f9840f11b09ebc591f1b0047f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173544 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sw/source/core/doc/docedt.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 98b53aa05457..a627e8de57b9 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -105,7 +105,8 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos, void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr ) { sw::SpzFrameFormats& rSpzs = *rRg.aStart.GetNode().GetDoc().GetSpzFrameFormats(); - for(sw::FrameFormats::size_type n = 0; n < rSpzs.size(); ++n ) + sw::FrameFormats::size_type n = 0; + while (n < rSpzs.size()) { auto pSpz = rSpzs[n]; SwFormatAnchor const*const pAnchor = &pSpz->GetAnchor(); @@ -126,8 +127,10 @@ void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr ) SwFormatAnchor aAnchor( pSpz->GetAnchor() ); aAnchor.SetAnchor(nullptr); pSpz->SetFormatAttr(aAnchor); - rSpzs.erase( rSpzs.begin() + n-- ); + rSpzs.erase( rSpzs.begin() + n ); + continue; } + ++n; } sw::CheckAnchoredFlyConsistency(rRg.aStart.GetNode().GetDoc()); }