File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1943,7 +1943,11 @@ await Task.Factory.StartNew(() =>
1943
1943
1944
1944
private void WatchForWin32FolderChanges ( string ? folderPath )
1945
1945
{
1946
- if ( Directory . Exists ( folderPath ) )
1946
+ if ( ! Directory . Exists ( folderPath ) )
1947
+ return ;
1948
+
1949
+ // NOTE: Suppressed NullReferenceException caused by EnableRaisingEvents
1950
+ SafetyExtensions . IgnoreExceptions ( ( ) =>
1947
1951
{
1948
1952
watcher = new FileSystemWatcher
1949
1953
{
@@ -1956,7 +1960,7 @@ private void WatchForWin32FolderChanges(string? folderPath)
1956
1960
watcher . Deleted += DirectoryWatcher_Changed ;
1957
1961
watcher . Renamed += DirectoryWatcher_Changed ;
1958
1962
watcher . EnableRaisingEvents = true ;
1959
- }
1963
+ } , App . Logger ) ;
1960
1964
}
1961
1965
1962
1966
private async void DirectoryWatcher_Changed ( object sender , FileSystemEventArgs e )
You can’t perform that action at this time.
0 commit comments