diff --git a/EverythingToolbar/Helpers/ToolbarLogger.cs b/EverythingToolbar/Helpers/ToolbarLogger.cs index a97843e6f..5788f4bc5 100644 --- a/EverythingToolbar/Helpers/ToolbarLogger.cs +++ b/EverythingToolbar/Helpers/ToolbarLogger.cs @@ -47,10 +47,15 @@ private static void InitializeExceptionLoggers(ILogger logger) { logger.Error((Exception)args.ExceptionObject, "Unhandled exception"); }; - Application.Current.DispatcherUnhandledException += (sender, args) => + + if (Application.Current != null) { - logger.Error(args.Exception, "Unhandled exception on UI thread"); - }; + // Not applicable for deskband + Application.Current.DispatcherUnhandledException += (sender, args) => + { + logger.Error(args.Exception, "Unhandled exception on UI thread"); + }; + } } private static void ConfigureLogger()