Decrease fragility in odd use cases with no current document

Change-Id: I9966166561d4c6e577f3f7e8e04572f97a0b295e
Reviewed-on: https://gerrit.libreoffice.org/49450
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
Tor Lillqvist
2018-02-08 19:31:20 +02:00
parent e0a94ded5d
commit 73256b9181
3 changed files with 17 additions and 4 deletions

View File

@@ -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();
}