Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a crash for users without a tab theme #16046

Merged
merged 1 commit into from Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cascadia/TerminalApp/TabManagement.cpp
Expand Up @@ -176,7 +176,9 @@ namespace winrt::TerminalApp::implementation
{
if (!profile.Icon().empty())
{
newTabImpl->UpdateIcon(profile.Icon(), _settings.GlobalSettings().CurrentTheme().Tab().IconStyle());
const auto theme = _settings.GlobalSettings().CurrentTheme();
const auto iconStyle = (theme && theme.Tab()) ? theme.Tab().IconStyle() : IconStyle::Default;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto tab = theme ? theme.Tab() : nullptr;
const auto iconStyle = tab ? tab. IconStyle() : IconStyle::Default;

…for the Tab() call deduplication (untested code). Not really an issue tho. Might not even be worth a "nit".

newTabImpl->UpdateIcon(profile.Icon(), iconStyle);
}
}

Expand Down Expand Up @@ -241,7 +243,9 @@ namespace winrt::TerminalApp::implementation
{
if (const auto profile = tab.GetFocusedProfile())
{
tab.UpdateIcon(profile.Icon(), _settings.GlobalSettings().CurrentTheme().Tab().IconStyle());
const auto theme = _settings.GlobalSettings().CurrentTheme();
const auto iconStyle = (theme && theme.Tab()) ? theme.Tab().IconStyle() : IconStyle::Default;
tab.UpdateIcon(profile.Icon(), iconStyle);
}
}

Expand Down