From 6ade3ef203238a211754c9c69000f155edd15ca9 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Fri, 23 Jun 2017 18:00:07 +0900 Subject: std::unordered_map can erase an element by given key, if any so that it is unneeded to find its position in advance. Change-Id: Iccf92f98b8683e4b2fb5252f5e05a357268b7033 Reviewed-on: https://gerrit.libreoffice.org/39156 Tested-by: Jenkins Reviewed-by: Julien Nabet --- basic/source/uno/scriptcont.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'basic') diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 4346a091ff01..44ee7c787244 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -1241,11 +1241,8 @@ void SAL_CALL SfxScriptLibrary::insertModuleInfo( const OUString& ModuleName, co void SAL_CALL SfxScriptLibrary::removeModuleInfo( const OUString& ModuleName ) { // #FIXME add NoSuchElementException to the spec - if ( !hasModuleInfo( ModuleName ) ) - { + if ( mModuleInfo.erase( ModuleName ) == 0 ) throw NoSuchElementException(); - } - mModuleInfo.erase( mModuleInfo.find( ModuleName ) ); } } // namespace basic -- cgit