diff --git a/Harmony/Internal/MethodPatcher.cs b/Harmony/Internal/MethodPatcher.cs index adda6f83..6c285765 100644 --- a/Harmony/Internal/MethodPatcher.cs +++ b/Harmony/Internal/MethodPatcher.cs @@ -378,6 +378,8 @@ static OpCode LoadIndOpCodeFor(Type type) if (type == typeof(int)) return OpCodes.Ldind_I4; if (type == typeof(long)) return OpCodes.Ldind_I8; + if (type == typeof(bool)) return OpCodes.Ldind_I4; + return OpCodes.Ldind_Ref; } @@ -399,6 +401,9 @@ static OpCode StoreIndOpCodeFor(Type type) if (type == typeof(int)) return OpCodes.Stind_I4; if (type == typeof(long)) return OpCodes.Stind_I8; + + if (type == typeof(bool)) return OpCodes.Stind_I4; + return OpCodes.Stind_Ref; }