diff options
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 5 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbaapplicationbase.cxx | 8 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbahelper.cxx | 8 |
3 files changed, 17 insertions, 4 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index f0ee0f7f7f56..97fe73dbface 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -409,7 +409,10 @@ uno::Reference< vba::XVBACompatibility > getVBACompatibility( const uno::Referen bool getDefaultVBAMode( StarBASIC* pb ) { - uno::Reference< vba::XVBACompatibility > xVBACompat = getVBACompatibility( getDocumentModel( pb ) ); + uno::Reference< frame::XModel > xModel( getDocumentModel( pb ) ); + if (!xModel.is()) + return false; + uno::Reference< vba::XVBACompatibility > xVBACompat = getVBACompatibility( xModel ); return xVBACompat.is() && xVBACompat->getVBACompatibilityMode(); } diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 753a389e5bb6..25e91647694b 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -184,7 +184,9 @@ VbaApplicationBase::~VbaApplicationBase() sal_Bool SAL_CALL VbaApplicationBase::getScreenUpdating() { - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModel > xModel = getCurrentDocument(); + if (!xModel.is()) + return false; return !xModel->hasControllersLocked(); } @@ -238,7 +240,9 @@ VbaApplicationBase::setDisplayStatusBar(sal_Bool bDisplayStatusBar) sal_Bool SAL_CALL VbaApplicationBase::getInteractive() { - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModel > xModel = getCurrentDocument(); + if (!xModel.is()) + return false; uno::Reference< frame::XFrame > xFrame( xModel->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); uno::Reference< awt::XWindow2 > xWindow( xFrame->getContainerWindow(), uno::UNO_QUERY_THROW ); diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 2471add85ce5..b7432c59935c 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -277,7 +277,13 @@ getCurrentWordDoc( const uno::Reference< uno::XComponentContext >& xContext ) } catch (const uno::Exception&) { - xModel = getThisWordDoc( xContext ); + try + { + xModel = getThisWordDoc( xContext ); + } + catch (const uno::Exception&) + { + } } return xModel; } |