Skip to content

Commit

Permalink
Fix a crash for users without a tab theme (#16046)
Browse files Browse the repository at this point in the history
One day into 1.19, and there's a LOT of hits here (**76.25%** of our
~300 crashes). A crash if the Theme doesn't have a `tab` member.

Regressed in #15948

Closes MSFT:46714723
  • Loading branch information
zadjii-msft committed Sep 28, 2023
1 parent 310814b commit cf19385
Showing 1 changed file with 6 additions and 2 deletions.
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;
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

0 comments on commit cf19385

Please sign in to comment.