forked from OSchip/llvm-project
[clang-format] Fix crash in getLengthToMatchingParen
Summary: Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8212 Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D47191 llvm-svn: 332961
This commit is contained in:
parent
11d68a619e
commit
f163bdc07e
|
@ -94,9 +94,9 @@ static unsigned getLengthToMatchingParen(const FormatToken &Tok,
|
|||
break;
|
||||
if (!End->Next->closesScope())
|
||||
continue;
|
||||
if (End->Next->MatchingParen->isOneOf(tok::l_brace,
|
||||
TT_ArrayInitializerLSquare,
|
||||
tok::less)) {
|
||||
if (End->Next->MatchingParen &&
|
||||
End->Next->MatchingParen->isOneOf(
|
||||
tok::l_brace, TT_ArrayInitializerLSquare, tok::less)) {
|
||||
const ParenState *State = FindParenState(End->Next->MatchingParen);
|
||||
if (State && State->BreakBeforeClosingBrace)
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue