Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Fix determining fields
Browse files Browse the repository at this point in the history
  • Loading branch information
misandrie committed May 28, 2024
1 parent 3f48da1 commit ff13911
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Marsey/PatchAssembly/AssemblyFieldHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


/// <summary>
/// Is the patch asking to be loaded before the game?
/// If marseypatch has a bool called "preload" - check it.
Expand All @@ -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;
}
Expand Down

0 comments on commit ff13911

Please sign in to comment.