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