From 15730b15aa36f3e7b43b2963a8c3ca79091ea5af Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 30 Mar 2025 14:59:30 +0800 Subject: [PATCH 1/2] Fix Application.Current null exception --- Flow.Launcher/ViewModel/MainViewModel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 56de70b4785..ea1e92b221d 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1464,8 +1464,8 @@ public bool ShouldIgnoreHotkeys() public void Show() { - // Invoke on UI thread - Application.Current.Dispatcher.Invoke(() => + // When application is exitting, the Application.Current will be null + Application.Current?.Dispatcher.Invoke(() => { // When application is exitting, the Application.Current will be null if (Application.Current?.MainWindow is MainWindow mainWindow) @@ -1539,8 +1539,8 @@ public async void Hide() break; } - // Invoke on UI thread - Application.Current.Dispatcher.Invoke(() => + // When application is exitting, the Application.Current will be null + Application.Current?.Dispatcher.Invoke(() => { // When application is exitting, the Application.Current will be null if (Application.Current?.MainWindow is MainWindow mainWindow) From aec4539326dfd41cfe75d59637c99161d5e14094 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 30 Mar 2025 15:01:41 +0800 Subject: [PATCH 2/2] Fix typos --- Flow.Launcher/ViewModel/MainViewModel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index ea1e92b221d..a155d2e43d5 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1464,10 +1464,10 @@ public bool ShouldIgnoreHotkeys() public void Show() { - // When application is exitting, the Application.Current will be null + // 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 @@ public async void Hide() break; } - // When application is exitting, the Application.Current will be null + // 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