Skip to content

Commit

Permalink
fix the crash with Rocket League (or more) profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Aytackydln committed Jun 13, 2024
1 parent e0f6c9b commit b738769
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Project-Aurora/Project-Aurora/Profiles/AutoJsonNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ public AutoJsonNode(string json) : base(json) {
// Compiled action to be run during the contructor that will populate relevant fields
private static readonly Lazy<Action<TSelf>> CtorAction = new(() => {
var fields = typeof(TSelf).GetFields(bf | BindingFlags.FlattenHierarchy);
var properties = typeof(TSelf).GetProperties();
var properties = typeof(TSelf).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
var body = new List<Expression>(fields.Length);
var selfParam = Parameter(typeof(TSelf));

var attributes = fields.Select(f => ((MemberInfo)f, f.FieldType)).Concat(properties.Select(p => ((MemberInfo)p, p.PropertyType)));
var fieldSetters = fields.Select(f => ((MemberInfo)f, f.FieldType));
var propertySetters = properties
.Where(p => p.CanWrite)
.Select(p => ((MemberInfo)p, p.PropertyType));
var attributes = fieldSetters.Concat(propertySetters);
// Find all the fields
foreach (var (field, type) in attributes.Where(f => f.Item1.GetCustomAttribute<AutoJsonIgnoreAttribute>() == null)) {
if (TryGetMethodForType(type, out var getter))
Expand Down

0 comments on commit b738769

Please sign in to comment.