Skip to content

Commit

Permalink
Merge pull request #2373 from Eneuman/master
Browse files Browse the repository at this point in the history
Resolves a null pointer exception when returning a Dictionary containing known keys
  • Loading branch information
domaindrivendev committed Nov 15, 2022
2 parents a6d3386 + 0c548a1 commit 2da3a72
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public SchemaGenerator(SchemaGeneratorOptions generatorOptions, ISerializerDataC
}

// NullableAttribute behaves diffrently for Dictionaries
if (modelType.IsGenericType && modelType.GetGenericTypeDefinition() == typeof(Dictionary<,>))
if (schema.AdditionalPropertiesAllowed && modelType.IsGenericType && modelType.GetGenericTypeDefinition() == typeof(Dictionary<,>))
{
schema.AdditionalProperties.Nullable = !memberInfo.IsDictionaryValueNonNullable();
}
Expand Down

0 comments on commit 2da3a72

Please sign in to comment.