Kaydet (Commit) 73256b91 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Decrease fragility in odd use cases with no current document

Change-Id: I9966166561d4c6e577f3f7e8e04572f97a0b295e
Reviewed-on: https://gerrit.libreoffice.org/49450Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
üst e0a94ded
......@@ -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();
}
......
......@@ -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 );
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment