Skip to content

Commit 5664c97

Browse files
committed
fixed NullReferenceException when VsNewContext refers to a class that isn't in the current project
1 parent 1686b6c commit 5664c97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Rubberduck.Parsing/Symbols/IdentifierReferenceListener.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ public override void EnterVsNew(VBAParser.VsNewContext context)
265265
? matches.SingleOrDefault()
266266
: GetClosestScopeDeclaration(matches, context, DeclarationType.Class);
267267

268+
if (result == null)
269+
{
270+
return;
271+
}
272+
268273
var reference = new IdentifierReference(_qualifiedName, result.IdentifierName, lastIdentifier.GetSelection(), context, result);
269274
result.AddReference(reference);
270275
}

0 commit comments

Comments
 (0)