Merge pull request #3401 from Flow-Launcher/application_current_null

Fix Application.Current null exception
This commit is contained in:
Jack Ye 2025-03-30 15:55:53 +08:00 committed by GitHub
commit d2cfa7f2fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1464,10 +1464,10 @@ namespace Flow.Launcher.ViewModel
public void Show()
{
// Invoke on UI thread
Application.Current.Dispatcher.Invoke(() =>
// When application is exiting, the Application.Current will be null
Application.Current?.Dispatcher.Invoke(() =>
{
// When application is exitting, the Application.Current will be null
// When application is exiting, the Application.Current will be null
if (Application.Current?.MainWindow is MainWindow mainWindow)
{
// 📌 Remove DWM Cloak (Make the window visible normally)
@ -1539,10 +1539,10 @@ namespace Flow.Launcher.ViewModel
break;
}
// Invoke on UI thread
Application.Current.Dispatcher.Invoke(() =>
// When application is exiting, the Application.Current will be null
Application.Current?.Dispatcher.Invoke(() =>
{
// When application is exitting, the Application.Current will be null
// When application is exiting, the Application.Current will be null
if (Application.Current?.MainWindow is MainWindow mainWindow)
{
// Set clock and search icon opacity