Skip to content

Commit 037a53a

Browse files
authored
fix null reference in breaking change attribute helper (#411)
1 parent e1f1fe7 commit 037a53a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Common/CustomAttributes/BreakingChangeAttributeHelper.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ public static IEnumerable<GenericBreakingChangeWithVersionAttribute> GetAllBreak
155155
attributeList.AddRange(f.GetCustomAttributes(typeof(GenericBreakingChangeWithVersionAttribute), false).Cast<GenericBreakingChangeWithVersionAttribute>());
156156
}
157157

158-
foreach (ParameterMetadata param in invocationInfo?.MyCommand?.Parameters?.Values)
159-
{
160-
attributeList.AddRange(param.Attributes.Where(a => a is GenericBreakingChangeWithVersionAttribute).Select(a => a as GenericBreakingChangeWithVersionAttribute));
158+
if (invocationInfo?.MyCommand?.Parameters?.Values != null) {
159+
foreach (ParameterMetadata param in invocationInfo.MyCommand.Parameters.Values)
160+
{
161+
attributeList.AddRange(param.Attributes.Where(a => a is GenericBreakingChangeWithVersionAttribute).Select(a => a as GenericBreakingChangeWithVersionAttribute));
162+
}
161163
}
162164

163165
return invocationInfo == null ? attributeList : attributeList.Where(e => e.IsApplicableToInvocation(invocationInfo));

0 commit comments

Comments
 (0)