Skip to content

Commit d5c9b77

Browse files
authored
Merge pull request #5229 from BZngr/EmptyMethos_InvalidCast
Avoid Invalid Cast exception in EmptyMethodInspection
2 parents 255c6bf + 180d9a1 commit d5c9b77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyMethodInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected override IEnumerable<IInspectionResult> DoGetInspectionResults()
4343

4444
return State.DeclarationFinder.UserDeclarations(DeclarationType.Member)
4545
.Where(member => !allInterfaces.Any(userInterface => userInterface.QualifiedModuleName == member.QualifiedModuleName)
46-
&& !((ModuleBodyElementDeclaration)member).Block.ContainsExecutableStatements())
46+
&& !(member is ModuleBodyElementDeclaration mbe && mbe.Block.ContainsExecutableStatements()))
4747

4848
.Select(result => new DeclarationInspectionResult(this,
4949
string.Format(InspectionResults.EmptyMethodInspection,

0 commit comments

Comments
 (0)