From 8c1a3422dbce3236ca310e0541ca9d1ead2fc166 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 16 Feb 2023 10:54:00 +0000 Subject: SfxRequest::GetMacroRecorder arg is always derefed before passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so null can never be seen in the function Change-Id: Iebe25ca26aa3f2105e4e20a0742c6cccbbf8b182 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147150 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sfx2/source/control/request.cxx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'sfx2/source/control/request.cxx') diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index e7757adc82ef..4cfeb629121c 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -164,7 +164,7 @@ SfxRequest::SfxRequest if (pImpl->pViewFrame->GetDispatcher()->GetShellAndSlot_Impl(nSlot, &pImpl->pShell, &pImpl->pSlot, true, true)) { pImpl->SetPool( &pImpl->pShell->GetPool() ); - pImpl->xRecorder = SfxRequest::GetMacroRecorder(pImpl->pViewFrame); + pImpl->xRecorder = SfxRequest::GetMacroRecorder(*pImpl->pViewFrame); if (pImpl->xRecorder) pImpl->xTransform = util::URLTransformer::create(comphelper::getProcessComponentContext()); pImpl->aTarget = pImpl->pShell->GetName(); @@ -205,7 +205,7 @@ SfxRequest::SfxRequest if( pImpl->pViewFrame->GetDispatcher()->GetShellAndSlot_Impl( nSlotId, &pImpl->pShell, &pImpl->pSlot, true, true ) ) { pImpl->SetPool( &pImpl->pShell->GetPool() ); - pImpl->xRecorder = SfxRequest::GetMacroRecorder( pViewFrame ); + pImpl->xRecorder = SfxRequest::GetMacroRecorder(*pViewFrame); if (pImpl->xRecorder) pImpl->xTransform = util::URLTransformer::create(comphelper::getProcessComponentContext()); pImpl->aTarget = pImpl->pShell->GetName(); @@ -673,7 +673,7 @@ bool SfxRequest::IsDone() const } -css::uno::Reference< css::frame::XDispatchRecorder > SfxRequest::GetMacroRecorder( SfxViewFrame const * pView ) +css::uno::Reference< css::frame::XDispatchRecorder > SfxRequest::GetMacroRecorder(const SfxViewFrame& rView) /* [Description] @@ -687,14 +687,8 @@ css::uno::Reference< css::frame::XDispatchRecorder > SfxRequest::GetMacroRecorde { css::uno::Reference< css::frame::XDispatchRecorder > xRecorder; - if (!pView) - pView = SfxViewFrame::Current(); - - if (!pView) - return xRecorder; - css::uno::Reference< css::beans::XPropertySet > xSet( - pView->GetFrame().GetFrameInterface(), + rView.GetFrame().GetFrameInterface(), css::uno::UNO_QUERY); if(xSet.is()) @@ -711,7 +705,7 @@ css::uno::Reference< css::frame::XDispatchRecorder > SfxRequest::GetMacroRecorde bool SfxRequest::HasMacroRecorder(const SfxViewFrame& rView) { - return GetMacroRecorder(&rView).is(); + return GetMacroRecorder(rView).is(); } bool SfxRequest::IsAPI() const -- cgit