summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-15 20:15:45 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-16 10:23:09 +0000
commit70e2383eaad96c8a6079613d9924063f41880724 (patch)
tree26872bdc128940ec90f775260dd1bcc1afb35654 /cui
parent56e0b27d39e266be49fac93361944878ff763acd (diff)
misc: check SfxViewFrame::Current()
these ones look potentially worth backporting Change-Id: Ie01c0b598c3408f4766318267de8438e997dd1a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144278 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/customize/CustomNotebookbarGenerator.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/cui/source/customize/CustomNotebookbarGenerator.cxx b/cui/source/customize/CustomNotebookbarGenerator.cxx
index 9fb71562160a..bae85525ebd6 100644
--- a/cui/source/customize/CustomNotebookbarGenerator.cxx
+++ b/cui/source/customize/CustomNotebookbarGenerator.cxx
@@ -74,11 +74,14 @@ static OUString lcl_getAppName(vcl::EnumContext::Application eApp)
static OUString getAppNameRegistryPath()
{
vcl::EnumContext::Application eApp = vcl::EnumContext::Application::Any;
- const Reference<frame::XFrame>& xFrame
- = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
- const Reference<frame::XModuleManager> xModuleManager
- = frame::ModuleManager::create(::comphelper::getProcessComponentContext());
- eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xFrame));
+
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+ {
+ const Reference<frame::XFrame>& xFrame = pViewFrame->GetFrame().GetFrameInterface();
+ const Reference<frame::XModuleManager> xModuleManager
+ = frame::ModuleManager::create(::comphelper::getProcessComponentContext());
+ eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xFrame));
+ }
OUString sAppName(lcl_getAppName(eApp));
return "org.openoffice.Office.UI.ToolbarMode/Applications/" + sAppName;