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

New commits:
commit 8f0e5308fac99f4c47fae98674f29a6a6a2948e5
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Aug 8 17:01:31 2022 +0200
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Aug 9 10:18:33 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/+/137990
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 8cc649675d8b..d708e55c5e19 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1309,7 +1309,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