summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-02-01 20:48:10 +0200
committerTor Lillqvist <tml@collabora.com>2018-02-01 20:48:15 +0200
commitef3d1bf9e35d4753c52883137e07236ce8617f2f (patch)
tree903cb38af8a1447acafa1ff954cbe15b52517617
parent1698425c6e2341835aef8c405c06482d4d78d73a (diff)
Don't crash if aArgs is empty
Change-Id: Icaa09de92fb25583f35139632fa8453e5fa4dd85
-rw-r--r--sw/source/ui/vba/vbaglobals.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx
index 9fd6514aaf7c..bfb9ffadcf07 100644
--- a/sw/source/ui/vba/vbaglobals.cxx
+++ b/sw/source/ui/vba/vbaglobals.cxx
@@ -36,12 +36,14 @@ using namespace ::ooo::vba;
SwVbaGlobals::SwVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& rxContext ) : SwVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext, "WordDocumentContext" )
{
SAL_INFO("sw.vba", "SwVbaGlobals::SwVbaGlobals()");
- uno::Sequence< beans::PropertyValue > aInitArgs( 2 );
+ uno::Sequence< beans::PropertyValue > aInitArgs( aArgs.getLength() + 1 );
aInitArgs[ 0 ].Name = "Application";
aInitArgs[ 0 ].Value <<= getApplication();
- aInitArgs[ 1 ].Name = "WordDocumentContext";
- aInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 );
-
+ if ( aArgs.getLength() > 0 )
+ {
+ aInitArgs[ 1 ].Name = "WordDocumentContext";
+ aInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 );
+ }
init( aInitArgs );
}