From d8e91627b96e1325a8859d8ee54cdf5e15516bb9 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Wed, 21 Sep 2016 21:09:37 +0200 Subject: tdf#101249 fixed crash after inserting OLE object Change-Id: I4ddd52f5da1745a2b9f2d6d54d5091d8f10107e7 Reviewed-on: https://gerrit.libreoffice.org/29155 Reviewed-by: Stephan Bergmann Tested-by: Stephan Bergmann --- sfx2/source/notebookbar/PriorityHBox.cxx | 11 +++++++---- sfx2/source/notebookbar/SfxNotebookBar.cxx | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/notebookbar/PriorityHBox.cxx b/sfx2/source/notebookbar/PriorityHBox.cxx index 46f62827f254..6071b7e2578d 100644 --- a/sfx2/source/notebookbar/PriorityHBox.cxx +++ b/sfx2/source/notebookbar/PriorityHBox.cxx @@ -100,12 +100,15 @@ public: m_bInitialized = true; SystemWindow* pSystemWindow = SfxViewFrame::Current()->GetFrame().GetSystemWindow(); - pSystemWindow->AddEventListener(LINK(this, PriorityHBox, WindowEventListener)); + if (pSystemWindow) + { + pSystemWindow->AddEventListener(LINK(this, PriorityHBox, WindowEventListener)); - CalcNeededWidth(); + CalcNeededWidth(); - long nWidth = pSystemWindow->GetSizePixel().Width(); - SetSizePixel(Size(nWidth, GetSizePixel().Height())); + long nWidth = pSystemWindow->GetSizePixel().Width(); + SetSizePixel(Size(nWidth, GetSizePixel().Height())); + } } VclHBox::Paint(rRenderContext, rRect); diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx index f3c343902834..db8db52ca529 100644 --- a/sfx2/source/notebookbar/SfxNotebookBar.cxx +++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx @@ -242,7 +242,13 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow, const Reference & xFrame, const OUString& rUIFile) { - assert(pSysWindow); + if (!pSysWindow) + { + if (SfxViewFrame::Current() && SfxViewFrame::Current()->GetWindow().GetSystemWindow()) + pSysWindow = SfxViewFrame::Current()->GetWindow().GetSystemWindow(); + else + return false; + } if (IsActive()) { -- cgit