Skip to content

Commit b4f2beb

Browse files
committed
Add null check when assigning null to AsTypeDeclaration
There are uncommon but theoretrically valid cases when the AsTypeDeclaration of a declaration is set to null. In these cases, a missing null check when setting IsSelfAssigned caused an NRE. Adding the null check prevents this and, as a result, makes the TypeAnnotationPass in the reference resolver safer.
1 parent f65094b commit b4f2beb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Rubberduck.Parsing/Symbols/Declaration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ internal set
529529
{
530530
_asTypeDeclaration = value;
531531
IsSelfAssigned = IsSelfAssigned || (DeclarationType == DeclarationType.Variable &&
532-
AsTypeDeclaration.DeclarationType == DeclarationType.UserDefinedType);
532+
AsTypeDeclaration?.DeclarationType == DeclarationType.UserDefinedType);
533533
}
534534
}
535535

0 commit comments

Comments
 (0)