From e7e659431c231be662dd954d66a18fdc9914e27a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 18 Jun 2009 05:55:53 +0000 Subject: [PATCH] Fix a crash that can occur when a #pragma handler eats to the end of the line, and when the pragma is at the end of a file. In this case, the last token consumed could pop the lexer, invalidating CurPPLexer. Thanks to Peter Thoman for pointing it out. llvm-svn: 73689 --- clang/lib/Lex/Pragma.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index 9776c2cfbd9e..3227d1cf09c5 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -93,7 +93,7 @@ void Preprocessor::HandlePragmaDirective() { PragmaHandlers->HandlePragma(*this, Tok); // If the pragma handler didn't read the rest of the line, consume it now. - if (CurPPLexer->ParsingPreprocessorDirective) + if (CurPPLexer && CurPPLexer->ParsingPreprocessorDirective) DiscardUntilEndOfDirective(); }