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