mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add null checks and fix dispatcher invocation in Theme
Added early returns if Application.Current is null in RefreshFrameAsync and SetBlurForWindowAsync to prevent null reference exceptions. Updated dispatcher access checks and ensured the correct method is invoked asynchronously for each case, improving robustness and reliability.
This commit is contained in:
parent
a83da2b00f
commit
84ed1fa1e1
1 changed files with 5 additions and 3 deletions
|
|
@ -644,7 +644,8 @@ namespace Flow.Launcher.Core.Resource
|
|||
/// </summary>
|
||||
public async Task RefreshFrameAsync()
|
||||
{
|
||||
if (Application.Current?.Dispatcher.CheckAccess() != true)
|
||||
if (Application.Current == null) return;
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
await Application.Current?.Dispatcher.InvokeAsync(RefreshFrameAsync);
|
||||
return;
|
||||
|
|
@ -676,9 +677,10 @@ namespace Flow.Launcher.Core.Resource
|
|||
/// </summary>
|
||||
public async Task SetBlurForWindowAsync()
|
||||
{
|
||||
if (Application.Current?.Dispatcher.CheckAccess() != true)
|
||||
if (Application.Current == null) return;
|
||||
if (!Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
await Application.Current?.Dispatcher.InvokeAsync(RefreshFrameAsync);
|
||||
await Application.Current?.Dispatcher.InvokeAsync(SetBlurForWindowAsync);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue