diff options
-rw-r--r-- | vcl/workben/outdevgrind.cxx | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx index cbcd1c555e85..528eae381abb 100644 --- a/vcl/workben/outdevgrind.cxx +++ b/vcl/workben/outdevgrind.cxx @@ -909,38 +909,51 @@ int GrindApp::Main() SAL_IMPLEMENT_MAIN() { - bool bHelp = false; - - for( sal_uInt16 i = 0; i < Application::GetCommandLineParamCount(); i++ ) + try { - OUString aParam = Application::GetCommandLineParam( i ); + bool bHelp = false; - if( aParam == "--help" || aParam == "-h" ) - bHelp = true; - } + for( sal_uInt16 i = 0; i < Application::GetCommandLineParamCount(); i++ ) + { + OUString aParam = Application::GetCommandLineParam( i ); - if( bHelp ) - { - printf( "outdevgrind - Profile OutputDevice\n" ); - return EXIT_SUCCESS; - } + if( aParam == "--help" || aParam == "-h" ) + bHelp = true; + } + + if( bHelp ) + { + printf( "outdevgrind - Profile OutputDevice\n" ); + return EXIT_SUCCESS; + } - tools::extendApplicationEnvironment(); + tools::extendApplicationEnvironment(); - uno::Reference< uno::XComponentContext > xContext = cppu::defaultBootstrap_InitialComponentContext(); - uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), uno::UNO_QUERY ); + uno::Reference< uno::XComponentContext > xContext = cppu::defaultBootstrap_InitialComponentContext(); + uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), uno::UNO_QUERY ); - if( !xServiceManager.is() ) - Application::Abort( "Failed to bootstrap" ); + if( !xServiceManager.is() ) + Application::Abort( "Failed to bootstrap" ); - comphelper::setProcessServiceFactory( xServiceManager ); + comphelper::setProcessServiceFactory( xServiceManager ); - InitVCL(); + InitVCL(); - GrindApp aGrindApp; - aGrindApp.Main(); + GrindApp aGrindApp; + aGrindApp.Main(); - DeInitVCL(); + DeInitVCL(); + } + catch (const css::uno::Exception& e) + { + SAL_WARN("vcl.app", "Fatal exception: " << e.Message); + return EXIT_FAILURE; + } + catch (const std::exception& e) + { + SAL_WARN("vcl.app", "Fatal exception: " << e.what()); + return EXIT_FAILURE; + } return EXIT_SUCCESS; } |