From 7d9c4596d153eb218e97c9781fbca63d7e092741 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 3 Jan 2013 20:10:03 +0100 Subject: [PATCH] Fix InvalidCastException in InconsistentNamingIssue. --- .../InconsistentNamingIssue/InconsistentNamingIssue.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/InconsistentNamingIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/InconsistentNamingIssue.cs index 02054e2ae0..8f6bb559c5 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/InconsistentNamingIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/InconsistentNamingIssue.cs @@ -55,8 +55,10 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring void CheckName(TypeDeclaration node, AffectedEntity entity, Identifier identifier, Modifiers accessibilty) { - ResolveResult resolveResult = ctx.Resolve(node); - var type = ((TypeResolveResult)resolveResult).Type; + TypeResolveResult resolveResult = ctx.Resolve(node) as TypeResolveResult; + if (resolveResult == null) + return; + var type = resolveResult.Type; if (type.DirectBaseTypes.Any(t => t.FullName == "System.Attribute")) { if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.CustomAttributes, identifier, accessibilty)) { return;