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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 14 15:47:10 UTC 2019


 sfx2/source/notify/eventsupplier.cxx |   31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

New commits:
commit d1ddbbf0350702b3dea0109eb923b7cf89e6d547
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 14 14:07:09 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 14 17:46:04 2019 +0200

    return early on empty type and script strings
    
    to make reading this clearer, no logic change intended
    
    Change-Id: Icc6e40df3bf10fde0168c7480e6a3d2d9b33bce2
    Reviewed-on: https://gerrit.libreoffice.org/77464
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index 99ff4c0d80e3..356d28c1430a 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -180,25 +180,29 @@ void SfxEvents_Impl::Execute( uno::Any const & aEventData, const document::Docum
         }
     }
 
-    if (aType == STAR_BASIC && !aScript.isEmpty())
+    if (aType.isEmpty())
+    {
+        // Empty type means no active binding for the event. Just ignore do nothing.
+        return;
+    }
+
+    if (aScript.isEmpty())
+        return;
+
+    if (aType == STAR_BASIC)
     {
         uno::Any aAny;
         SfxMacroLoader::loadMacro( aScript, aAny, pDoc );
     }
-    else if (aType == "Service" ||
-              aType == "Script")
+    else if (aType == "Service" || aType == "Script")
     {
-        bool bAllowed = false;
         util::URL aURL;
-        if (!aScript.isEmpty())
-        {
-            uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
+        uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
 
-            aURL.Complete = aScript;
-            xTrans->parseStrict( aURL );
+        aURL.Complete = aScript;
+        xTrans->parseStrict( aURL );
 
-            bAllowed = !SfxObjectShell::UnTrustedScript(aURL.Complete);
-        }
+        bool bAllowed = !SfxObjectShell::UnTrustedScript(aURL.Complete);
 
         if (bAllowed)
         {
@@ -226,7 +230,6 @@ void SfxEvents_Impl::Execute( uno::Any const & aEventData, const document::Docum
 
             if ( xDisp.is() )
             {
-
                 beans::PropertyValue aEventParam;
                 aEventParam.Value <<= aTrigger;
                 uno::Sequence< beans::PropertyValue > aDispatchArgs( &aEventParam, 1 );
@@ -234,10 +237,6 @@ void SfxEvents_Impl::Execute( uno::Any const & aEventData, const document::Docum
             }
         }
     }
-    else if ( aType.isEmpty() )
-    {
-        // Empty type means no active binding for the event. Just ignore do nothing.
-    }
     else
     {
         SAL_WARN( "sfx.notify", "notifyEvent(): Unsupported event type" );


More information about the Libreoffice-commits mailing list