[Libreoffice-commits] core.git: sw/source

Mike Kaganski mike.kaganski at collabora.com
Thu Jul 5 15:04:06 UTC 2018


 sw/source/uibase/uiview/pview.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 8a20bf4a7df90d789753026c1e5b1b6fcf319d6c
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Thu Jul 5 14:00:33 2018 +0200

    tdf#118546: GetNotebookBar() may return nullptr
    
    Change-Id: I411ea0abcb5fd5fac0db7fe0c4bad16a0c1b9d77
    Reviewed-on: https://gerrit.libreoffice.org/57006
    Reviewed-by: Kshitij Pathania <kshitijpathania at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 2a83ada829e0..d43a0460fd48 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1164,7 +1164,8 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
     SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview));
     SfxShell::BroadcastContextForActivation(true);
     //removelisteners for notebookbar
-    SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar()->ControlListener(true);
+    if (auto& pBar = SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar())
+        pBar->ControlListener(true);
 
     SfxObjectShell* pObjShell = pViewFrame->GetObjectShell();
     if ( !pOldSh )
@@ -1230,7 +1231,8 @@ SwPagePreview::~SwPagePreview()
     delete pVShell;
 
     m_pViewWin.disposeAndClear();
-    SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar()->ControlListener(false);
+    if (auto& pBar = SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar())
+        pBar->ControlListener(false);
     m_pScrollFill.disposeAndClear();
     m_pHScrollbar.disposeAndClear();
     m_pVScrollbar.disposeAndClear();


More information about the Libreoffice-commits mailing list