summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-15 20:00:26 +0000
committerXisco Fauli <xiscofauli@libreoffice.org>2022-12-16 07:53:00 +0000
commitc70c85b67c5f5e046eacfcabcde37edc58653f35 (patch)
tree78932453cc0bd579099a5c477901f0e480d1ce2e /sfx2
parent17852f4b6964a65f778863c197dfa3a924929195 (diff)
sfx2: check SfxViewFrame::Current()
these ones look potentially worth backporting Change-Id: I9391f266b08e3842f9686db6113b61fa814f3fbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144257 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/app.cxx2
-rw-r--r--sfx2/source/commandpopup/CommandPopup.cxx2
-rw-r--r--sfx2/source/control/charmapcontrol.cxx7
-rw-r--r--sfx2/source/control/request.cxx8
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())