From 34f182a12334cd25be9f250ff4da295a5a64142f Mon Sep 17 00:00:00 2001 From: Dale McCoy <21223975+DaleStan@users.noreply.github.com> Date: Mon, 23 Jan 2023 22:28:37 -0500 Subject: [PATCH] Fix at one bug revealed by #199. pcall(require, '__nonexistent-mod__/file') doesn't fail in a way that Lua can handle. --- YAFCparser/FactorioDataSource.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/YAFCparser/FactorioDataSource.cs b/YAFCparser/FactorioDataSource.cs index 87c97072..2442292d 100644 --- a/YAFCparser/FactorioDataSource.cs +++ b/YAFCparser/FactorioDataSource.cs @@ -63,7 +63,8 @@ public static bool ModPathExists(string modName, string path) public static byte[] ReadModFile(string modName, string path) { - var info = allMods[modName]; + if (!allMods.TryGetValue(modName, out var info)) + return null; if (info.zipArchive != null) { var entry = info.zipArchive.GetEntry(info.folder + path);