diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-05 10:34:06 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-05 14:57:58 +0000 |
commit | 8310ff534e4df002912d9315c13dde7f0627c650 (patch) | |
tree | 7b399a94bbf58408e75c60478872cf4b2020943f /svtools/langsupport | |
parent | d6fdebc5439887f5998e9e8c21d87f5ccdcdc505 (diff) |
coverity#737920 Uncaught exception
Change-Id: I282b874c22c373e078007a29bcbbe74b175a70d3
Diffstat (limited to 'svtools/langsupport')
-rw-r--r-- | svtools/langsupport/langsupport.cxx | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/svtools/langsupport/langsupport.cxx b/svtools/langsupport/langsupport.cxx index 9dbc90ecabf1..b9038d0d8996 100644 --- a/svtools/langsupport/langsupport.cxx +++ b/svtools/langsupport/langsupport.cxx @@ -22,45 +22,53 @@ using namespace com::sun::star; SAL_IMPLEMENT_MAIN() { - tools::extendApplicationEnvironment(); + try + { + tools::extendApplicationEnvironment(); - uno::Reference<uno::XComponentContext> xContext = - cppu::defaultBootstrap_InitialComponentContext(); + uno::Reference<uno::XComponentContext> xContext = + cppu::defaultBootstrap_InitialComponentContext(); - uno::Reference<lang::XMultiComponentFactory> xFactory = - xContext->getServiceManager(); + uno::Reference<lang::XMultiComponentFactory> xFactory = + xContext->getServiceManager(); - uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory, - uno::UNO_QUERY_THROW); + uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory, + uno::UNO_QUERY_THROW); - comphelper::setProcessServiceFactory(xSFactory); + comphelper::setProcessServiceFactory(xSFactory); - InitVCL(); + InitVCL(); - { - sal_uInt32 nCount = SvtLanguageTable::GetLanguageEntryCount(); - for (sal_uInt32 i = 0; i < nCount; ++i) { - LanguageType eLang = SvtLanguageTable::GetLanguageTypeAtIndex(i); - - if (eLang == LANGUAGE_DONTKNOW || - eLang == LANGUAGE_NONE || - eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE || - eLang == LANGUAGE_SYSTEM) + sal_uInt32 nCount = SvtLanguageTable::GetLanguageEntryCount(); + for (sal_uInt32 i = 0; i < nCount; ++i) { - continue; - } + LanguageType eLang = SvtLanguageTable::GetLanguageTypeAtIndex(i); + + if (eLang == LANGUAGE_DONTKNOW || + eLang == LANGUAGE_NONE || + eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE || + eLang == LANGUAGE_SYSTEM) + { + continue; + } - OUString sTag( LanguageTag::convertToBcp47( eLang)); + OUString sTag( LanguageTag::convertToBcp47( eLang)); - std::cout << OUStringToOString(sTag, osl_getThreadTextEncoding()).getStr() - << std::endl; + std::cout << OUStringToOString(sTag, osl_getThreadTextEncoding()).getStr() + << std::endl; + } } - } - DeInitVCL(); + DeInitVCL(); - uno::Reference< lang::XComponent >(xContext, uno::UNO_QUERY_THROW)->dispose(); + uno::Reference< lang::XComponent >(xContext, uno::UNO_QUERY_THROW)->dispose(); + } + catch (const uno::Exception& e) + { + SAL_WARN("vcl.app", "Fatal exception: " << e.Message); + return 1; + } return 0; } |