a977ad
From 22005041f829d85e675ea27bdee1770af58a1ea0 Mon Sep 17 00:00:00 2001
a977ad
From: Stephan Bergmann <sbergman@redhat.com>
a977ad
Date: Mon, 3 Jun 2019 16:21:24 +0200
a977ad
Subject: [PATCH] AppendInfoBar can return null
a977ad
a977ad
e.g., when opening the old help window ("Help - LibreOffice Help" in a build
a977ad
configured with --with-help to "build the old local help" (configure.ac))
a977ad
a977ad
Change-Id: Icecd224774b98811ddf9545c5fa83a85fab259fc
a977ad
Reviewed-on: https://gerrit.libreoffice.org/73390
a977ad
Tested-by: Jenkins
a977ad
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
a977ad
---
a977ad
 sfx2/source/view/viewfrm.cxx | 24 ++++++++++++++----------
a977ad
 1 file changed, 14 insertions(+), 10 deletions(-)
a977ad
a977ad
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
a977ad
index 5620f4396e8f..ed8ffa200ef6 100644
a977ad
--- a/sfx2/source/view/viewfrm.cxx
a977ad
+++ b/sfx2/source/view/viewfrm.cxx
a977ad
@@ -1239,16 +1239,20 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
a977ad
                     if ((iCurrent > iLast) && !Application::IsHeadlessModeEnabled() && !bIsUITest)
a977ad
                     {
a977ad
                         VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", SfxResId(STR_WHATSNEW_TEXT), InfoBarType::Info);
a977ad
-                        VclPtrInstance<PushButton> xWhatsNewButton(&GetWindow());
a977ad
-                        xWhatsNewButton->SetText(SfxResId(STR_WHATSNEW_BUTTON));
a977ad
-                        xWhatsNewButton->SetSizePixel(xWhatsNewButton->GetOptimalSize());
a977ad
-                        xWhatsNewButton->SetClickHdl(LINK(this, SfxViewFrame, WhatsNewHandler));
a977ad
-                        pInfoBar->addButton(xWhatsNewButton);
a977ad
-
a977ad
-                        //update lastversion
a977ad
-                        std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
a977ad
-                        officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion, batch);
a977ad
-                        batch->commit();
a977ad
+                        if (pInfoBar)
a977ad
+                        {
a977ad
+                            VclPtrInstance<PushButton> xWhatsNewButton(&GetWindow());
a977ad
+                            xWhatsNewButton->SetText(SfxResId(STR_WHATSNEW_BUTTON));
a977ad
+                            xWhatsNewButton->SetSizePixel(xWhatsNewButton->GetOptimalSize());
a977ad
+                            xWhatsNewButton->SetClickHdl(LINK(this, SfxViewFrame, WhatsNewHandler));
a977ad
+                            pInfoBar->addButton(xWhatsNewButton);
a977ad
+
a977ad
+                            //update lastversion
a977ad
+                            std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
a977ad
+                            officecfg::Setup::Product::ooSetupLastVersion::set(
a977ad
+                                sSetupVersion, batch);
a977ad
+                            batch->commit();
a977ad
+                        }
a977ad
                     }
a977ad
                 }
a977ad
 
a977ad
-- 
a977ad
2.25.1
a977ad