diff --git a/Marsey/PatchAssembly/AssemblyFieldHandler.cs b/Marsey/PatchAssembly/AssemblyFieldHandler.cs index 1b18f9e..eb35399 100644 --- a/Marsey/PatchAssembly/AssemblyFieldHandler.cs +++ b/Marsey/PatchAssembly/AssemblyFieldHandler.cs @@ -86,12 +86,15 @@ public static bool DetermineIgnore(Type DataType) { FieldInfo? ignoreFieldInfo = DataType.GetField("ignoreFields"); - if (ignoreFieldInfo != null) - return ignoreFieldInfo.GetValue(null) is bool; + if (ignoreFieldInfo != null && ignoreFieldInfo.FieldType == typeof(bool)) + { + return (bool)(ignoreFieldInfo.GetValue(null) ?? false); + } return false; } + /// /// Is the patch asking to be loaded before the game? /// If marseypatch has a bool called "preload" - check it. @@ -101,8 +104,10 @@ public static bool DeterminePreload(Type DataType) { FieldInfo? preloadFieldInfo = DataType.GetField("preload"); - if (preloadFieldInfo != null) - return preloadFieldInfo.GetValue(null) is bool; + if (preloadFieldInfo != null && preloadFieldInfo.FieldType == typeof(bool)) + { + return (bool)(preloadFieldInfo.GetValue(null) ?? false); + } return false; }