aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-23 10:09:28 +0000
committerManuel Klimek <klimek@google.com>2013-01-23 10:09:28 +0000
commit092a2c7373c02d1653bea1feb1ada05363b02bc2 (patch)
treec0d5d66b2b470f485eba416f310f1e169e0c54ae /lib/Format/Format.cpp
parent8f4bd7a20f89d9065bebadd270e6bc7822257d37 (diff)
Fix segfaults in the formatter.
Also: expletive deleted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index bdcf5b67fe..90bcf6feb7 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1049,7 +1049,7 @@ public:
break;
case tok::kw_if:
case tok::kw_while:
- if (CurrentToken->is(tok::l_paren)) {
+ if (CurrentToken != NULL && CurrentToken->is(tok::l_paren)) {
next();
if (!parseParens(/*LookForDecls=*/true))
return false;
@@ -1088,7 +1088,7 @@ public:
Tok->Type = TT_BinaryOperator;
break;
case tok::kw_operator:
- if (CurrentToken->is(tok::l_paren)) {
+ if (CurrentToken != NULL && CurrentToken->is(tok::l_paren)) {
CurrentToken->Type = TT_OverloadedOperator;
next();
if (CurrentToken != NULL && CurrentToken->is(tok::r_paren)) {