Skip to content

Commit ed18c1e

Browse files
zadjii-msftminiksa
authored andcommitted
Fix the About Dialog II: This Time it's Optional (microsoft#2122)
* Get rid of this unused variable * This is the actual fix to the about dialog crashing: an unchecked optional variable
1 parent 10c599e commit ed18c1e

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

src/cascadia/TerminalApp/App.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ namespace winrt::TerminalApp::implementation
202202
const auto package = winrt::Windows::ApplicationModel::Package::Current();
203203
const auto packageName = package.DisplayName();
204204
const auto version = package.Id().Version();
205-
Windows::UI::Xaml::Media::SolidColorBrush blueBrush{ Windows::UI::ColorHelper::FromArgb(255, 0, 115, 207) };
206205
winrt::Windows::UI::Xaml::Documents::Run about;
207206
winrt::Windows::UI::Xaml::Documents::Run gettingStarted;
208207
winrt::Windows::UI::Xaml::Documents::Run documentation;
@@ -245,10 +244,6 @@ namespace winrt::TerminalApp::implementation
245244

246245
const auto buttonText = _resourceLoader.GetLocalizedString(L"Ok");
247246

248-
gettingStartedLink.Foreground(blueBrush);
249-
documentationLink.Foreground(blueBrush);
250-
releaseNotesLink.Foreground(blueBrush);
251-
252247
Controls::TextBlock aboutTextBlock;
253248
aboutTextBlock.Inlines().Append(about);
254249
aboutTextBlock.Inlines().Append(gettingStartedLink);
@@ -721,21 +716,25 @@ namespace winrt::TerminalApp::implementation
721716
void App::_UpdateTitle(std::shared_ptr<Tab> tab)
722717
{
723718
auto newTabTitle = tab->GetFocusedTitle();
724-
const auto lastFocusedProfile = tab->GetFocusedProfile().value();
725-
const auto* const matchingProfile = _settings->FindProfile(lastFocusedProfile);
719+
const auto lastFocusedProfileOpt = tab->GetFocusedProfile();
720+
if (lastFocusedProfileOpt.has_value())
721+
{
722+
const auto lastFocusedProfile = lastFocusedProfileOpt.value();
723+
const auto* const matchingProfile = _settings->FindProfile(lastFocusedProfile);
726724

727-
const auto tabTitle = matchingProfile->GetTabTitle();
725+
const auto tabTitle = matchingProfile->GetTabTitle();
728726

729-
// Checks if tab title has been set in the profile settings and
730-
// updates accordingly.
727+
// Checks if tab title has been set in the profile settings and
728+
// updates accordingly.
731729

732-
const auto newActualTitle = tabTitle.empty() ? newTabTitle : tabTitle;
730+
const auto newActualTitle = tabTitle.empty() ? newTabTitle : tabTitle;
733731

734-
tab->SetTabText(winrt::to_hstring(newActualTitle.data()));
735-
if (_settings->GlobalSettings().GetShowTitleInTitlebar() &&
736-
tab->IsFocused())
737-
{
738-
_titleChangeHandlers(newActualTitle);
732+
tab->SetTabText(winrt::to_hstring(newActualTitle.data()));
733+
if (_settings->GlobalSettings().GetShowTitleInTitlebar() &&
734+
tab->IsFocused())
735+
{
736+
_titleChangeHandlers(newActualTitle);
737+
}
739738
}
740739
}
741740

0 commit comments

Comments
 (0)