Browse files

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

  • Loading branch information...
1 parent 6d1e90b commit 1a1487fd5b95d87d4d38feb5c54bbaa853316162 @mkrueger mkrueger committed Apr 18, 2012
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);
+ }
}
}

0 comments on commit 1a1487f

Please sign in to comment.