Skip to content

Commit 70bc54d

Browse files
committed
Fix NRE in RunSelectedTestMethodCommand.CanExecute when no declaration is selected
1 parent 0f90058 commit 70bc54d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Rubberduck.Core/UI/Command/RunSelectedTestMethodCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ private Declaration FindDeclarationFromSelection()
5050

5151
private bool IsTestMethod(Declaration member)
5252
{
53-
return member.DeclarationType == DeclarationType.Procedure
53+
return member != null
54+
&& member.DeclarationType == DeclarationType.Procedure
5455
&& member.Annotations.Any(parseTreeAnnotation =>
5556
parseTreeAnnotation.Annotation is TestMethodAnnotation);
5657
}

0 commit comments

Comments
 (0)