summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-14 14:07:09 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-08-14 17:46:04 +0200
commitd1ddbbf0350702b3dea0109eb923b7cf89e6d547 (patch)
treee8d03d7e141d6ea05fca409d2a1bb2a1d26da707 /sfx2
parentf1b35902203bd2937b86a6d521fe0fb7c466142a (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/notify/eventsupplier.cxx31
1 files changed, 15 insertions, 16 deletions
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" );