diff options
-rwxr-xr-x | vbahelper/source/vbahelper/collectionbase.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/vbahelper/source/vbahelper/collectionbase.cxx b/vbahelper/source/vbahelper/collectionbase.cxx index 7a99aabecdf8..16fc673f54d5 100755 --- a/vbahelper/source/vbahelper/collectionbase.cxx +++ b/vbahelper/source/vbahelper/collectionbase.cxx @@ -314,11 +314,10 @@ uno::Any CollectionBase::getAnyItemOrThis( const uno::Any& rIndex ) throw (uno:: { if( !rIndex.hasValue() ) return uno::Any( uno::Reference< XCollectionBase >( this ) ); - if( rIndex.has< sal_Int32 >() ) - return getItemByIndex( rIndex.get< sal_Int32 >() ); if( rIndex.has< ::rtl::OUString >() ) return getItemByName( rIndex.get< ::rtl::OUString >() ); - throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid item index." ) ), 0 ); + // extractIntFromAny() throws if no index can be extracted + return getItemByIndex( extractIntFromAny( rIndex ) ); } // protected ------------------------------------------------------------------ |