Skip to content

Commit 06c3704

Browse files
committed
Fixes null reference exception in SA1129
1 parent c3c1e4d commit 06c3704

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1129DoNotUseDefaultValueTypeConstructor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private static void HandleObjectCreationExpression(SyntaxNodeAnalysisContext con
5151
ObjectCreationExpressionSyntax newExpression = (ObjectCreationExpressionSyntax)context.Node;
5252

5353
var typeToCreate = context.SemanticModel.GetTypeInfo(newExpression, context.CancellationToken);
54-
if (typeToCreate.Type.IsReferenceType || IsReferenceTypeParameter(typeToCreate.Type))
54+
if ((typeToCreate.Type == null) || typeToCreate.Type.IsReferenceType || IsReferenceTypeParameter(typeToCreate.Type))
5555
{
5656
return;
5757
}

0 commit comments

Comments
 (0)