Skip to content

Commit

Permalink
Get / Set method could be null
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiao921 committed Jan 24, 2022
1 parent e3dabd1 commit 1490127
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void AnalyzeSimpleMemberAccess(SyntaxNodeAnalysisContext context)
{
var memberAccess = (MemberAccessExpressionSyntax)context.Node;
var symbol = context.SemanticModel.GetSymbolInfo(memberAccess.Name, context.CancellationToken).Symbol;

if (symbol == null)
return;

Expand All @@ -62,12 +62,12 @@ private void AnalyzeSimpleMemberAccess(SyntaxNodeAnalysisContext context)
var propertyUsage = context.Node.GetPropertyUsage();
if (propertyUsage == Extensions.PropertyUsage.Get || propertyUsage == Extensions.PropertyUsage.GetAndSet)
{
var getMethodPublicizedAttribute = propertySymbol.GetMethod.GetAttribute(PublicizedAttributeName);
var getMethodPublicizedAttribute = propertySymbol.GetMethod?.GetAttribute(PublicizedAttributeName);
Check(getMethodPublicizedAttribute, symbol, context, memberAccess);
}
else
{
var setMethodPublicizedAttribute = propertySymbol.SetMethod.GetAttribute(PublicizedAttributeName);
var setMethodPublicizedAttribute = propertySymbol.SetMethod?.GetAttribute(PublicizedAttributeName);
Check(setMethodPublicizedAttribute, symbol, context, memberAccess);
}
}
Expand Down

0 comments on commit 1490127

Please sign in to comment.