From 3671fc3aacfe75c210d416ee2f60505eb929dfe0 Mon Sep 17 00:00:00 2001 From: AKruimink <43521957+AKruimink@users.noreply.github.com> Date: Fri, 6 Sep 2024 02:12:06 +0100 Subject: [PATCH] Adds a null check to ensure the current application is not null when we try to update the list of active applications --- src/WinReform/WinReform/ActiveWindows/ActiveWindowsViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WinReform/WinReform/ActiveWindows/ActiveWindowsViewModel.cs b/src/WinReform/WinReform/ActiveWindows/ActiveWindowsViewModel.cs index 9c5404d..7e5d141 100644 --- a/src/WinReform/WinReform/ActiveWindows/ActiveWindowsViewModel.cs +++ b/src/WinReform/WinReform/ActiveWindows/ActiveWindowsViewModel.cs @@ -157,7 +157,7 @@ public void RefreshActiveWindows() Task.Run(() => { var result = _windowService.GetActiveWindows().ToList(); - Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => ActiveWindows.UpdateCollection(result))); + Application.Current?.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => ActiveWindows.UpdateCollection(result))); }); }