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 )