diff options
-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()) |