diff options
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/aeitem.cxx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 03431b91594a..cafa6fe3a3b7 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -108,11 +108,14 @@ void SfxAllEnumItem::InsertValue( sal_uInt16 nValue, const OUString &rValue ) SfxAllEnumValue_Impl aVal; aVal.nValue = nValue; aVal.aText = rValue; + sal_uInt16 nPos = GetPosByValue(nValue); if ( !pValues ) pValues.reset( new SfxAllEnumValueArr ); - else if ( GetPosByValue( nValue ) != USHRT_MAX ) + else if ( nPos != USHRT_MAX ) + { // remove when exists - RemoveValue( nValue ); + pValues->erase( pValues->begin() + nPos ); + } // then insert pValues->insert(pValues->begin() + GetPosByValue_(nValue), aVal); // FIXME: Duplicates? } @@ -128,11 +131,4 @@ void SfxAllEnumItem::InsertValue( sal_uInt16 nValue ) pValues->insert(pValues->begin() + GetPosByValue_(nValue), aVal); // FIXME: Duplicates? } -void SfxAllEnumItem::RemoveValue( sal_uInt16 nValue ) -{ - sal_uInt16 nPos = GetPosByValue(nValue); - assert(nPos != USHRT_MAX); - pValues->erase( pValues->begin() + nPos ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |