sw/source/ui/vba/vbaglobals.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit ef3d1bf9e35d4753c52883137e07236ce8617f2f
Author: Tor Lillqvist <t...@collabora.com>
Date:   Thu Feb 1 20:48:10 2018 +0200

    Don't crash if aArgs is empty
    
    Change-Id: Icaa09de92fb25583f35139632fa8453e5fa4dd85

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 );
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to