diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-08-08 17:01:31 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-08-09 12:06:24 +0200 |
commit | 6e770a30cea55142892b8ef0ddb515ef1c77d2ea (patch) | |
tree | b8a86d829d56b54594a3848fe6f1f3f5b091e10a | |
parent | 43ba49cd33af6bc8328edb0cb8c289bab266e346 (diff) |
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 <xiscofauli@libreoffice.org>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
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)); |