sfx2/source/appl/newhelp.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 08d1ff386546e0926b9fe0d186c565112010fc2b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Aug 8 17:01:31 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Aug 10 09:09:42 2022 +0200

    sfx2: check saved last tab page name exists before restoring it
    
    since GetPage might return nullptr on a nonexisting page
    
    See 
https://crashreport.libreoffice.org/stats/signature/SfxHelpIndexWindow_Impl::ActivatePageHdl(rtl::OString%20const%20&)
    
    Change-Id: I26e21f783645e8a87d56cbe76c0126de8947bf3e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138014
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 701369f378c7..d9fdc9d0cb59 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1308,7 +1308,11 @@ 
SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent, w
     OString sPageId("index");
     SvtViewOptions aViewOpt( EViewType::TabDialog, CONFIGNAME_INDEXWIN );
     if ( aViewOpt.Exists() )
-        sPageId = aViewOpt.GetPageID();
+    {
+        OString sSavedPageId = aViewOpt.GetPageID();
+        if (m_xTabCtrl->get_page_index(sSavedPageId) != -1)
+            sPageId = sSavedPageId;
+    }
     m_xTabCtrl->set_current_page(sPageId);
     ActivatePageHdl(sPageId);
     m_xActiveLB->connect_changed(LINK(this, SfxHelpIndexWindow_Impl, 
SelectHdl));

Reply via email to