Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Formatting] Checked token for null, before using the parent.

  • Loading branch information...
commit 1a1487fd5b95d87d4d38feb5c54bbaa853316162 1 parent 6d1e90b
@mkrueger mkrueger authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs
View
12 ICSharpCode.NRefactory.CSharp/Formatter/AstFormattingVisitor.cs
@@ -874,8 +874,10 @@ void FormatParameters(AstNode node)
}
ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
}
- foreach (CSharpTokenNode comma in rParToken.Parent.Children.Where(n => n.Role == Roles.Comma)) {
- ForceSpacesBefore(comma, spaceBeforeMethodCallParameterComma);
+ if (!rParToken.IsNull) {
+ foreach (CSharpTokenNode comma in rParToken.Parent.Children.Where(n => n.Role == Roles.Comma)) {
+ ForceSpacesBefore(comma, spaceBeforeMethodCallParameterComma);
+ }
}
}
@@ -1777,8 +1779,10 @@ void FormatArguments(AstNode node)
}
ForceSpacesBeforeRemoveNewLines(rParToken, spaceWithinMethodCallParentheses);
}
- foreach (CSharpTokenNode comma in rParToken.Parent.Children.Where(n => n.Role == Roles.Comma)) {
- ForceSpacesBefore(comma, spaceBeforeMethodCallParameterComma);
+ if (!rParToken.IsNull) {
+ foreach (CSharpTokenNode comma in rParToken.Parent.Children.Where(n => n.Role == Roles.Comma)) {
+ ForceSpacesBefore(comma, spaceBeforeMethodCallParameterComma);
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.