Browse Source

Fixed possible null reference exception.

newNRvisualizers
mike 14 years ago
parent
commit
54b3baee81
  1. 2
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs

2
ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs

@ -430,6 +430,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
bool wrapInClass = memberLocation != new TextLocation (1, 1); bool wrapInClass = memberLocation != new TextLocation (1, 1);
if (wrapInClass) { if (wrapInClass) {
var nodeAtLocation = Unit.GetNodeAt (memberLocation, n => n is TypeDeclaration || n is NamespaceDeclaration); var nodeAtLocation = Unit.GetNodeAt (memberLocation, n => n is TypeDeclaration || n is NamespaceDeclaration);
if (nodeAtLocation != null) {
foreach (var n in nodeAtLocation.AncestorsAndSelf) { foreach (var n in nodeAtLocation.AncestorsAndSelf) {
if (memberLocation == n.StartLocation) { if (memberLocation == n.StartLocation) {
continue; continue;
@ -459,6 +460,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
} }
} }
} }
}
wrapper.Append(memberText); wrapper.Append(memberText);
wrapper.Append(continuation); wrapper.Append(continuation);
AppendMissingClosingBrackets(wrapper, memberText, appendSemicolon); AppendMissingClosingBrackets(wrapper, memberText, appendSemicolon);

Loading…
Cancel
Save