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

New commits:
commit 6e770a30cea55142892b8ef0ddb515ef1c77d2ea
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Aug 8 17:01:31 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Aug 9 12:06:24 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/+/138015
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins

diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index b3b7483bb29a..850a2b207962 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1305,7 +1305,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