Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Format/UnwrappedLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,7 @@ bool UnwrappedLineParser::tryToParsePropertyAccessor() {
if (!Style.isCSharp())
return false;
// See if it's a property accessor.
if (FormatTok->Previous->isNot(tok::identifier))
if (!FormatTok->Previous || FormatTok->Previous->isNot(tok::identifier))
return false;

// See if we are inside a property accessor.
Expand Down
12 changes: 12 additions & 0 deletions clang/unittests/Format/FormatTestCSharp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,18 @@ TEST_F(FormatTestCSharp, BrokenBrackets) {
EXPECT_NE("", format("int where b <")); // reduced from crasher
}

TEST_F(FormatTestCSharp, GotoCaseLabel) {
verifyNoCrash("switch (i) {\n"
"case 0:\n"
" goto case 1;\n"
"case 1:\n"
" j = 0;\n"
" {\n"
" break;\n"
" }\n"
"}");
}

} // namespace
} // namespace test
} // namespace format
Expand Down
Loading