Skip to content

Commit

Permalink
BenMorris/NetArchTest#137 - NRE when constant field has null value
Browse files Browse the repository at this point in the history
  • Loading branch information
NeVeSpl committed Dec 22, 2023
1 parent 1fa2adc commit 9062afb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sources/NetArchTest/Dependencies/TypeCheckingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void CheckFields(TypeDefinition typeToCheck)
{
CheckCustomAttributes(field);
CheckTypeReference(field.FieldType);
if (_serachForDependencyInFieldConstant && field.HasConstant && field.FieldType.FullName == typeof(string).FullName)
if (_serachForDependencyInFieldConstant && field.HasConstant && field.FieldType.FullName == typeof(string).FullName && field.Constant != null)
{
_result.CheckType(field.Constant.ToString());
}
Expand Down

0 comments on commit 9062afb

Please sign in to comment.