From: Eike Rathke Date: Tue, 10 Jul 2018 20:58:52 +0000 (+0200) Subject: ScGlobal::OpenURL: obtain pViewFrm early and bail out if not available X-Git-Tag: archive/raspbian/1%6.1.5-3+rpi1+deb10u11^2~13 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c24c20c498e3afa2291e4687c0553e64aa0a2280;p=libreoffice.git ScGlobal::OpenURL: obtain pViewFrm early and bail out if not available Unnecessary to init a bunch of stuff if not. Change-Id: Ica80185370ecc341bda5b1615ff6d765b579f45e Gbp-Pq: Name 0085-ScGlobal-OpenURL-obtain-pViewFrm-early-and-bail-out-.patch --- diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index cb5a13ceed0..08e0deacae7 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -824,6 +824,11 @@ void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget) // other key combo. and security option is set, so return return; } + + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + if (!pViewFrm) + return; + SfxStringItem aUrl( SID_FILE_NAME, rURL ); SfxStringItem aTarget( SID_TARGETNAME, rTarget ); if ( nScClickMouseModifier & KEY_SHIFT ) // control-click -> into new window @@ -845,13 +850,9 @@ void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget) SfxBoolItem aBrowsing( SID_BROWSE, true ); // No SID_SILENT anymore - SfxViewFrame* pViewFrm = SfxViewFrame::Current(); - if (pViewFrm) - { - pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC, - SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, - { &aUrl, &aTarget, &aFrm, &aReferer, &aNewView, &aBrowsing }); - } + pViewFrm->GetDispatcher()->ExecuteList(SID_OPENDOC, + SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, + { &aUrl, &aTarget, &aFrm, &aReferer, &aNewView, &aBrowsing }); } bool ScGlobal::IsSystemRTL()