Browse Source

fix possible NullReferenceExceptions in ResolveExtensionMethod; should fix http://usagedatacollector.sharpdevelop.net/analysis/ExceptionGroup/Edit/229

pull/1/head
Siegfried Pammer 15 years ago
parent
commit
e209002178
  1. 11
      src/AddIns/Misc/SharpRefactoring/Project/Src/MenuItemFactories/ResolveExtensionMethod.cs

11
src/AddIns/Misc/SharpRefactoring/Project/Src/MenuItemFactories/ResolveExtensionMethod.cs

@ -28,9 +28,14 @@ namespace SharpRefactoring @@ -28,9 +28,14 @@ namespace SharpRefactoring
return null;
if (!(context.ResolveResult is UnknownMethodResolveResult))
return null;
if (context.ProjectContent == null)
return null;
UnknownMethodResolveResult rr = context.ResolveResult as UnknownMethodResolveResult;
if (rr.CallingClass == null)
return null;
MenuItem item = new MenuItem() {
Header = string.Format(StringParser.Parse("${res:AddIns.SharpRefactoring.ResolveExtensionMethod}"), rr.CallName),
Icon = ClassBrowserIconService.GotoArrow.CreateImage()
@ -38,11 +43,9 @@ namespace SharpRefactoring @@ -38,11 +43,9 @@ namespace SharpRefactoring
List<IClass> results = new List<IClass>();
IProjectContent pc = rr.CallingClass.ProjectContent;
SearchAllExtensionMethodsWithName(results, pc, rr.CallName);
SearchAllExtensionMethodsWithName(results, context.ProjectContent, rr.CallName);
foreach (IProjectContent content in pc.ReferencedContents)
foreach (IProjectContent content in context.ProjectContent.ReferencedContents)
SearchAllExtensionMethodsWithName(results, content, rr.CallName);
if (!results.Any())

Loading…
Cancel
Save