From cf193858f6e12da49d98eba541c69a636041f9f3 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Thu, 28 Sep 2023 09:34:03 -0500 Subject: [PATCH] Fix a crash for users without a `tab` theme (#16046) 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 --- src/cascadia/TerminalApp/TabManagement.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalApp/TabManagement.cpp b/src/cascadia/TerminalApp/TabManagement.cpp index d727989162d..bb77019aad5 100644 --- a/src/cascadia/TerminalApp/TabManagement.cpp +++ b/src/cascadia/TerminalApp/TabManagement.cpp @@ -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); } } @@ -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); } }