From f625771cd07fd03681cd3799507a97b39fc8f8c4 Mon Sep 17 00:00:00 2001 From: kalimag <kalimag@users.noreply.github.com> Date: Sun, 27 Nov 2022 19:54:20 +0100 Subject: [PATCH] Don't create FileSystemWatcher for missing directories --- src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index 718e197c60..f0577a6b1b 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -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,