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 | 733b278f48ae0d9bf7251ce7f5b8375ef9f10c86 (patch) | |
tree | cade44c6d0a9ab06537363d0c028d9247902cac8 /lib/Format/FormatToken.cpp | |
parent | 9b623a9ba964c636e2fb865dc5d8b18a76f07ca8 (diff) |
clang-format: Fix crash on invalid code.
Input "a<," made clang-format crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/FormatToken.cpp')
-rw-r--r-- | lib/Format/FormatToken.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Format/FormatToken.cpp b/lib/Format/FormatToken.cpp index badb3a39c8..0addbfed0c 100644 --- a/lib/Format/FormatToken.cpp +++ b/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. |