Skip to content

Commit d2cfa7f

Browse files
authored
Merge pull request #3401 from Flow-Launcher/application_current_null
Fix Application.Current null exception
2 parents f07c09f + aec4539 commit d2cfa7f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1464,10 +1464,10 @@ public bool ShouldIgnoreHotkeys()
14641464

14651465
public void Show()
14661466
{
1467-
// Invoke on UI thread
1468-
Application.Current.Dispatcher.Invoke(() =>
1467+
// When application is exiting, the Application.Current will be null
1468+
Application.Current?.Dispatcher.Invoke(() =>
14691469
{
1470-
// When application is exitting, the Application.Current will be null
1470+
// When application is exiting, the Application.Current will be null
14711471
if (Application.Current?.MainWindow is MainWindow mainWindow)
14721472
{
14731473
// 📌 Remove DWM Cloak (Make the window visible normally)
@@ -1539,10 +1539,10 @@ public async void Hide()
15391539
break;
15401540
}
15411541

1542-
// Invoke on UI thread
1543-
Application.Current.Dispatcher.Invoke(() =>
1542+
// When application is exiting, the Application.Current will be null
1543+
Application.Current?.Dispatcher.Invoke(() =>
15441544
{
1545-
// When application is exitting, the Application.Current will be null
1545+
// When application is exiting, the Application.Current will be null
15461546
if (Application.Current?.MainWindow is MainWindow mainWindow)
15471547
{
15481548
// Set clock and search icon opacity

0 commit comments

Comments
 (0)