summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/FormatToken.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-01-19 10:51:42 +0000
committerDaniel Jasper <djasper@google.com>2015-01-19 10:51:42 +0000
commit20e8c3be3ca1b24ddac51e4cfd67eba1cb551210 (patch)
treed905fceeb1a40d48ca97ddf58ec9364aa5210b3e /clang/lib/Format/FormatToken.cpp
parent675b4f8350a868081a5a33f03f49fbe7c5f56b31 (diff)
downloadbcm5719-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.cpp3
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.
OpenPOWER on IntegriCloud