Skip to content

Commit

Permalink
Fix: Fixed NullReferenceException in ThemeHelper part 2 (#12185)
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu committed Apr 24, 2023
1 parent cad12e6 commit b125abf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Files.App/Helpers/ThemeHelper.cs
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

0 comments on commit b125abf

Please sign in to comment.