[Libreoffice-commits] core.git: sc/source

Tor Lillqvist tml at collabora.com
Wed Feb 7 10:20:17 UTC 2018


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

New commits:
commit 403d52a66085db8109024bfe07f2bfc2c4ccdc03
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Feb 7 00:58:08 2018 +0200

    Don't crash if aArgs is empty
    
    Change-Id: I6a6495ab5729bc45a0049fcbab884752267570be
    Reviewed-on: https://gerrit.libreoffice.org/49336
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx
index 189fe708f2f0..c4636c7bf1f0 100644
--- a/sc/source/ui/vba/vbaglobals.cxx
+++ b/sc/source/ui/vba/vbaglobals.cxx
@@ -40,12 +40,14 @@ using namespace ::ooo::vba;
 
 ScVbaGlobals::ScVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& rxContext ) : ScVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext, "ExcelDocumentContext" )
 {
-    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 = "ExcelDocumentContext";
-    aInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 );
-
+    if ( aArgs.getLength() > 0 )
+    {
+        aInitArgs[ 1 ].Name = "ExcelDocumentContext";
+        aInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 );
+    }
     init( aInitArgs );
 }
 


More information about the Libreoffice-commits mailing list