Browse Source

fixed NullReferenceException in CSharpMethodExtractor when trying to extract code with unresolved entities (e. g. missing usings)

pull/2/head
Siegfried Pammer 15 years ago
parent
commit
d208f264b4
  1. 4
      src/AddIns/Misc/SharpRefactoring/Project/Src/CSharpMethodExtractor.cs

4
src/AddIns/Misc/SharpRefactoring/Project/Src/CSharpMethodExtractor.cs

@ -57,9 +57,7 @@ namespace SharpRefactoring @@ -57,9 +57,7 @@ namespace SharpRefactoring
this.currentProjectContent = ParserService.GetProjectContent(ProjectService.CurrentProject);
MethodDeclaration newMethod = new MethodDeclaration();
List<VariableDeclaration> possibleReturnValues = new List<VariableDeclaration>();
List<VariableDeclaration> otherReturnValues = new List<VariableDeclaration>();
// Initialise new method
@ -188,7 +186,7 @@ namespace SharpRefactoring @@ -188,7 +186,7 @@ namespace SharpRefactoring
Dom.IReturnType type = currentProjectContent.SystemTypes.Object;
Dom.ClassFinder finder = new Dom.ClassFinder(currentClass, textEditor.Caret.Line, textEditor.Caret.Column);
if (result != null)
if (result != null && result.ResolvedType != null)
type = result.ResolvedType;
if (variable.Type.Type == "var")

Loading…
Cancel
Save