Skip to content

Commit d6b465e

Browse files
Andrin Meierretailcoder
authored andcommitted
handle astypedeclaration==null (#1625)
1 parent 325ef89 commit d6b465e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Rubberduck.Parsing/Binding/IndexDefaultBinding.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ with a parameter list that cannot accept any parameters and an <argument-list> t
132132
IBoundExpression boundExpression = null;
133133
var asTypeName = lExpression.ReferencedDeclaration.AsTypeName;
134134
var asTypeDeclaration = lExpression.ReferencedDeclaration.AsTypeDeclaration;
135+
if (asTypeDeclaration == null)
136+
{
137+
return null;
138+
}
135139
boundExpression = ResolveDefaultMember(lExpression, asTypeName, asTypeDeclaration);
136140
if (boundExpression != null)
137141
{
@@ -169,8 +173,7 @@ private IBoundExpression ResolveDefaultMember(IBoundExpression lExpression, stri
169173
The declared type of <l-expression> is a specific class, which has a public default Property
170174
Get, Property Let, function or subroutine, and one of the following is true:
171175
*/
172-
bool hasDefaultMember = asTypeDeclaration != null
173-
&& asTypeDeclaration.DeclarationType == DeclarationType.ClassModule
176+
bool hasDefaultMember = asTypeDeclaration.DeclarationType == DeclarationType.ClassModule
174177
&& ((ClassModuleDeclaration)asTypeDeclaration).DefaultMember != null;
175178
if (hasDefaultMember)
176179
{

0 commit comments

Comments
 (0)