diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-12-15 20:00:26 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-12-16 09:58:56 +0000 |
commit | 4a998d9eea012896d4a5d256048407a766fc0bbd (patch) | |
tree | ca43351a8d521ab0197577a7537fec380050d45a /sfx2 | |
parent | b07703963cad433e22fbe9c27f3bee5dc7a7ca63 (diff) |
sfx2: check SfxViewFrame::Current()
these ones look potentially worth backporting
Change-Id: I9391f266b08e3842f9686db6113b61fa814f3fbb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144276
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/app.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/commandpopup/CommandPopup.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/charmapcontrol.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/control/request.cxx | 8 |
4 files changed, 15 insertions, 4 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 4b5adbdf8a2b..3d3adb84bfe4 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -410,7 +410,7 @@ IMPL_STATIC_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBas const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); std::shared_ptr<weld::MessageDialog> xBox; xBox.reset(Application::CreateMessageDialog( - pViewFrame->GetFrameWeld(), + pViewFrame ? pViewFrame->GetFrameWeld() : nullptr, VclMessageType::Error, VclButtonsType::Ok, aError, diff --git a/sfx2/source/commandpopup/CommandPopup.cxx b/sfx2/source/commandpopup/CommandPopup.cxx index 47df143a889b..f4cdf92436c7 100644 --- a/sfx2/source/commandpopup/CommandPopup.cxx +++ b/sfx2/source/commandpopup/CommandPopup.cxx @@ -152,6 +152,8 @@ void MenuContentHandler::addCommandIfPossible( return; auto* pViewFrame = SfxViewFrame::Current(); + if (!pViewFrame) + return; SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame); const SfxSlot* pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path); diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx index 032306b8a85f..a79da745be26 100644 --- a/sfx2/source/control/charmapcontrol.cxx +++ b/sfx2/source/control/charmapcontrol.cxx @@ -207,8 +207,11 @@ IMPL_LINK_NOARG(SfxCharmapCtrl, OpenDlgHdl, weld::Button&, void) { m_xControl->EndPopupMode(); - uno::Reference<frame::XFrame> xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); - comphelper::dispatchCommand(".uno:InsertSymbol", xFrame, {}); + if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) + { + uno::Reference<frame::XFrame> xFrame = pViewFrm->GetFrame().GetFrameInterface(); + comphelper::dispatchCommand(".uno:InsertSymbol", xFrame, {}); + } } void SfxCharmapCtrl::GrabFocus() diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index 964a256b19a7..b43d1dd991bc 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -687,8 +687,14 @@ 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 ? pView : SfxViewFrame::Current())->GetFrame().GetFrameInterface(), + pView->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY); if(xSet.is()) |