Following "Simplify a bit SfxAllEnumItem (svl)"

As Mike suggested in:
https://gerrit.libreoffice.org/#/c/80089/

Change-Id: Ie33cb1464907215ec23bf7be7cf5ce3fafdf6113
Reviewed-on: https://gerrit.libreoffice.org/80161
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet
2019-10-03 20:45:02 +02:00
parent 34095197fc
commit 30308a8b4c

View File

@@ -108,10 +108,9 @@ void SfxAllEnumItem::InsertValue( sal_uInt16 nValue, const OUString &rValue )
SfxAllEnumValue_Impl aVal; SfxAllEnumValue_Impl aVal;
aVal.nValue = nValue; aVal.nValue = nValue;
aVal.aText = rValue; aVal.aText = rValue;
sal_uInt16 nPos = GetPosByValue(nValue);
if ( !pValues ) if ( !pValues )
pValues.reset( new SfxAllEnumValueArr ); pValues.reset( new SfxAllEnumValueArr );
else if ( nPos != USHRT_MAX ) else if ( sal_uInt16 nPos = GetPosByValue(nValue); nPos != USHRT_MAX )
{ {
// remove when exists // remove when exists
pValues->erase( pValues->begin() + nPos ); pValues->erase( pValues->begin() + nPos );