summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-01-19 10:51:23 +0000
committerDaniel Jasper <djasper@google.com>2015-01-19 10:51:23 +0000
commit675b4f8350a868081a5a33f03f49fbe7c5f56b31 (patch)
treead5dc556e4e8961ba12b47bdbc50a202420ffe0f /clang/lib/Format/ContinuationIndenter.cpp
parent9d22bcc53e70a597ccdfc2c4c1a2276a5bbeee00 (diff)
downloadbcm5719-llvm-675b4f8350a868081a5a33f03f49fbe7c5f56b31.tar.gz
bcm5719-llvm-675b4f8350a868081a5a33f03f49fbe7c5f56b31.zip
clang-format: Fix clang-format crash on invalid code.
llvm-svn: 226449
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 4b5ad599734..7cf1c844678 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -516,7 +516,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
if (NextNonComment->is(tok::l_brace) && NextNonComment->BlockKind == BK_Block)
return Current.NestingLevel == 0 ? State.FirstIndent
: State.Stack.back().Indent;
- if (Current.isOneOf(tok::r_brace, tok::r_square)) {
+ if (Current.isOneOf(tok::r_brace, tok::r_square) && State.Stack.size() > 1) {
if (Current.closesBlockTypeList(Style))
return State.Stack[State.Stack.size() - 2].NestedBlockIndent;
if (Current.MatchingParen &&
OpenPOWER on IntegriCloud