diff --git a/src/Workspaces/CSharp/Portable/Formatting/Rules/NewLineUserSettingFormattingRule.cs b/src/Workspaces/CSharp/Portable/Formatting/Rules/NewLineUserSettingFormattingRule.cs index 85be420dc5f4b..5a9fe4879efab 100644 --- a/src/Workspaces/CSharp/Portable/Formatting/Rules/NewLineUserSettingFormattingRule.cs +++ b/src/Workspaces/CSharp/Portable/Formatting/Rules/NewLineUserSettingFormattingRule.cs @@ -11,12 +11,12 @@ internal class NewLineUserSettingFormattingRule : BaseFormattingRule { private bool IsControlBlock(SyntaxNode node) { - if (node.Kind() == SyntaxKind.SwitchStatement) + if (node?.Kind() == SyntaxKind.SwitchStatement) { return true; } - var parentKind = node?.Parent.Kind(); + var parentKind = node?.Parent?.Kind(); switch (parentKind.GetValueOrDefault()) { case SyntaxKind.IfStatement: