diff --git a/Cpp2IL.Core/Analysis/FieldUtils.cs b/Cpp2IL.Core/Analysis/FieldUtils.cs index 4c83414e..020df391 100644 --- a/Cpp2IL.Core/Analysis/FieldUtils.cs +++ b/Cpp2IL.Core/Analysis/FieldUtils.cs @@ -89,7 +89,12 @@ private static List RecalculateFieldOffsetsForGenericType(TypeRefer private static FieldBeingAccessedData? GetIndirectlyPointedAtField(List allFields, ulong offset, bool tryFindFloatingPointValue) { //We have no field directly at this offset - find the one immediately prior, and map that struct to its own fields - var structFIT = allFields.FindLast(f => !f.Static && f.Offset <= offset); + + FieldInType structFIT = default(FieldInType); + + foreach (var field in allFields) + if (!field.Static && field.Offset <= offset && field.Offset > structFIT.Offset) + structFIT = field; if (structFIT.FieldType == null || structFIT.Constant != null) return null; //Couldn't find one, or they're all constants