Permalink
Browse files

Fixing a NullReferenceException in data types auto-update

  • Loading branch information...
napernik committed Oct 25, 2017
1 parent 504fd8b commit e332459bf4fe3afea85ef322399d4365309b4237
Showing with 11 additions and 1 deletion.
  1. +11 −1 Composite/Data/DynamicTypes/DynamicTypeManager.cs
@@ -390,7 +390,17 @@ internal static bool EnsureUpdateStore(Type interfaceType, string providerName,
.Contains(f.Name));
foreach (var field in customFields)
{
newDataTypeDescriptor.Fields.Remove(newDataTypeDescriptor.Fields[field.Name]);
var fieldDescriptor = newDataTypeDescriptor.Fields[field.Name];
if (fieldDescriptor != null)
{
newDataTypeDescriptor.Fields.Remove(fieldDescriptor);
}
else
{
Log.LogWarning(nameof(DynamicTypeManager), $"Property '{field.Name}' was missing in the generated interface type '{interfaceType.FullName}'");
}
newDataTypeDescriptor.Fields.Add(field);
}
}

0 comments on commit e332459

Please sign in to comment.