svtools/source/control/valueset.cxx | 4 +--- vcl/source/treelist/headbar.cxx | 8 +------- 2 files changed, 2 insertions(+), 10 deletions(-)
New commits: commit 3339fd9a3fbbeca3af1239487146b61486c8145f Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Dec 6 21:09:34 2024 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Mon Dec 9 10:46:15 2024 +0100 remove some range checks which are more likely to hide an underlying bug than they are to help Change-Id: Ifba3c38e9dc6c3d47c9c62bebf5b5e68f11d9ee7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178004 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/source/treelist/headbar.cxx b/vcl/source/treelist/headbar.cxx index 2e34f15439b1..e8588b0371c6 100644 --- a/vcl/source/treelist/headbar.cxx +++ b/vcl/source/treelist/headbar.cxx @@ -1069,13 +1069,7 @@ void HeaderBar::RemoveItem( sal_uInt16 nItemId ) { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - { - if ( nPos < mvItemList.size() ) { - auto it = mvItemList.begin(); - it += nPos; - mvItemList.erase( it ); - } - } + mvItemList.erase( mvItemList.begin() + nPos ); } void HeaderBar::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) commit d18ab050c4ce0536abd4bc9339a6dd1436172d7e Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Dec 6 20:24:44 2024 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Mon Dec 9 10:46:06 2024 +0100 remove some range checks which are more likely to hide an underlying bug than they are to help Change-Id: I3bcac401d62f9baf27e72bacb6bb0a2315d1c081 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178000 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index a3dcb17d9a77..f1437e6aa0be 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -524,9 +524,7 @@ void ValueSet::RemoveItem( sal_uInt16 nItemId ) if ( nPos == VALUESET_ITEM_NOTFOUND ) return; - if ( nPos < mItemList.size() ) { - mItemList.erase( mItemList.begin() + nPos ); - } + mItemList.erase( mItemList.begin() + nPos ); // reset variables if (mnHighItemId == nItemId || mnSelItemId == nItemId)