diff options
author | Daniel Jasper <djasper@google.com> | 2015-01-19 10:51:42 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-01-19 10:51:42 +0000 |
commit | 20e8c3be3ca1b24ddac51e4cfd67eba1cb551210 (patch) | |
tree | d905fceeb1a40d48ca97ddf58ec9364aa5210b3e /clang/lib/Format/FormatToken.cpp | |
parent | 675b4f8350a868081a5a33f03f49fbe7c5f56b31 (diff) | |
download | bcm5719-llvm-20e8c3be3ca1b24ddac51e4cfd67eba1cb551210.tar.gz bcm5719-llvm-20e8c3be3ca1b24ddac51e4cfd67eba1cb551210.zip |
clang-format: Fix crash on invalid code.
Input "a<," made clang-format crash.
llvm-svn: 226450
Diffstat (limited to 'clang/lib/Format/FormatToken.cpp')
-rw-r--r-- | clang/lib/Format/FormatToken.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp index badb3a39c82..0addbfed0ce 100644 --- a/clang/lib/Format/FormatToken.cpp +++ b/clang/lib/Format/FormatToken.cpp @@ -59,7 +59,8 @@ void TokenRole::precomputeFormattingInfos(const FormatToken *Token) {} unsigned CommaSeparatedList::formatAfterToken(LineState &State, ContinuationIndenter *Indenter, bool DryRun) { - if (!State.NextToken->Previous || !State.NextToken->Previous->Previous) + if (State.NextToken == nullptr || !State.NextToken->Previous || + !State.NextToken->Previous->Previous) return 0; // Ensure that we start on the opening brace. |