From 738728f2b838f201470e93f0f4e5dcd0f9cf4b8a Mon Sep 17 00:00:00 2001 From: BDisp Date: Mon, 14 Nov 2022 18:26:38 +0000 Subject: [PATCH] Fixes System.NullReferenceException exception. --- Terminal.Gui/Windows/FileDialog.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Terminal.Gui/Windows/FileDialog.cs b/Terminal.Gui/Windows/FileDialog.cs index 53e37558e..26b07688b 100644 --- a/Terminal.Gui/Windows/FileDialog.cs +++ b/Terminal.Gui/Windows/FileDialog.cs @@ -116,11 +116,17 @@ namespace Terminal.Gui { void Watcher_Error (object sender, ErrorEventArgs e) { + if (Application.MainLoop == null) + return; + Application.MainLoop.Invoke (() => Reload ()); } void Watcher_Changed (object sender, FileSystemEventArgs e) { + if (Application.MainLoop == null) + return; + Application.MainLoop.Invoke (() => Reload ()); }