Settings: Fix a blank page when reopening settings on the Search tab

The saved tab was selected before the Search tab was added, so the index
was out of range and no tab was created. Select it after adding Search, and
create the current tab anyway if the saved one no longer exists (Search is
hidden on small screens).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-22 10:55:30 +02:00
1 parent f5059f9948
commit 0c8c447284
2 files changed
+11 -5

No files matched your search

+7 -5
View File
@@ -114,11 +114,6 @@ void UITabbedBaseDialogScreen::CreateViews() {
// Let the subclass create its tabs.
CreateTabs();
if (currentTabSetting_) {
tabHolder_->SetInitialTab(*currentTabSetting_);
} else {
tabHolder_->EnsureTab(tabHolder_->GetCurrentTab());
}
tabHolder_->OnChangeTab.Add([this](UI::EventParams &e) {
if (currentTabSetting_) {
@@ -151,6 +146,13 @@ void UITabbedBaseDialogScreen::CreateViews() {
}
}
// After the search tab, which the saved tab can be.
if (currentTabSetting_) {
tabHolder_->SetInitialTab(*currentTabSetting_);
} else {
tabHolder_->EnsureTab(tabHolder_->GetCurrentTab());
}
// Need to handle recreates, both important and accidental ones.
if (!searchFilter_.empty()) {
ApplySearchFilter();