Don't create FileSystemWatcher for missing directories

This commit is contained in:
kalimag 2022-11-27 19:54:20 +01:00 committed by James Groom
parent cf2b83b102
commit f625771cd0
1 changed files with 5 additions and 0 deletions

View File

@ -279,6 +279,11 @@ namespace BizHawk.Client.EmuHawk
return;
var (dir, file) = item.Path.MakeProgramRelativePath().SplitPathToDirAndFile();
// prevent error when (auto)loading session referencing scripts in deleted/renamed directories
if (!Directory.Exists(dir))
return;
var watcher = new FileSystemWatcher
{
Path = dir,