Browse Source

fixed NullReferenceException in CSharpMethodExtractor

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6189 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 15 years ago
parent
commit
69c39842b0
  1. 2
      src/AddIns/Analysis/Profiler/Controller/ProfilerOptions.cs
  2. 7
      src/AddIns/Misc/SharpRefactoring/Project/Src/CSharpMethodExtractor.cs
  3. 1
      src/AddIns/Misc/SharpRefactoring/Project/Src/IntroduceMethod.cs
  4. 2
      src/AddIns/Misc/SharpRefactoring/Project/Src/Options.cs

2
src/AddIns/Analysis/Profiler/Controller/ProfilerOptions.cs

@ -28,7 +28,7 @@ namespace ICSharpCode.Profiler.Controller @@ -28,7 +28,7 @@ namespace ICSharpCode.Profiler.Controller
/// Defines a list of default performance counters.
/// </summary>
public static readonly PerformanceCounterDescriptor[] DefaultCounters = new[] {
new PerformanceCounterDescriptor("Process", "% Processor Time", "_Total", ".", 0, 0, 100, "%", "0.00"),
new PerformanceCounterDescriptor("Process", "% Processor Time", "_Total", ".", 0, 0, null, "%", "0.00"),
new PerformanceCounterDescriptor("Process", "IO Data Bytes/sec", "_Total", ".", 0, null, null, "bytes/sec", "#,##0")
};

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

@ -9,7 +9,6 @@ using System; @@ -9,7 +9,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.Ast;
@ -73,11 +72,15 @@ namespace SharpRefactoring @@ -73,11 +72,15 @@ namespace SharpRefactoring
this.parentNode = GetParentMember(start, end);
if (parentNode == null) {
Dom.IMember member = GetParentMember(textEditor, textEditor.Caret.Line, textEditor.Caret.Column);
if (parentNode == null || member == null) {
MessageService.ShowError("${res:AddIns.SharpRefactoring.ExtractMethod.InvalidSelection}");
return false;
}
this.currentClass = member.DeclaringType;
ErrorKind kind = CheckForJumpInstructions(newMethod);
if (kind != ErrorKind.None) {
switch (kind) {

1
src/AddIns/Misc/SharpRefactoring/Project/Src/IntroduceMethod.cs

@ -82,6 +82,7 @@ namespace SharpRefactoring @@ -82,6 +82,7 @@ namespace SharpRefactoring
{
if (rr.Target == null || rr.Target.GetUnderlyingClass() == null)
return null;
NRefactoryResolver resolver = CreateResolverForContext(rr.CallingClass.ProjectContent.Language, editor);
Ast.INode node = resolver.ParseCurrentMember(editor.Document.Text);
resolver.RunLookupTableVisitor(node);

2
src/AddIns/Misc/SharpRefactoring/Project/Src/Options.cs

@ -19,7 +19,7 @@ namespace SharpRefactoring @@ -19,7 +19,7 @@ namespace SharpRefactoring
static Properties properties;
public static Properties Properties {
get {
get {
Debug.Assert(properties != null);
return properties;
}

Loading…
Cancel
Save