Skip to content

Fix: Fixed NullReferenceException in ThemeHelper part 2 #12185

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Files.App/Helpers/ThemeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void Initialize()

// Set TitleBar background color
if (currentApplicationWindow is not null)
titleBar = App.GetAppWindow(currentApplicationWindow).TitleBar;
titleBar = App.GetAppWindow(currentApplicationWindow)?.TitleBar;

// Apply the desired theme based on what is set in the application settings
ApplyTheme();
Expand All @@ -67,12 +67,13 @@ private static async void UiSettings_ColorValuesChanged(UISettings sender, objec
{
currentApplicationWindow = App.Window;

if (currentApplicationWindow is not null)
titleBar = App.GetAppWindow(currentApplicationWindow).TitleBar;
else
if (currentApplicationWindow is null)
return;
}

if (titleBar is null)
titleBar = App.GetAppWindow(currentApplicationWindow)?.TitleBar;

// Dispatch on UI thread so that we have a current appbar to access and change
await currentApplicationWindow.DispatcherQueue.EnqueueAsync(ApplyTheme);
}
Expand Down