From: Ted Kremenek Date: Mon, 28 Jun 2010 20:32:40 +0000 (+0000) Subject: Don't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ae4c919205307c6e98e6c920aa55019040cbe77;p=clang Don't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107061 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index c9c76e5f1f..349dd7bf98 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -84,7 +84,8 @@ static void AddImplicitIncludePTH(MacroBuilder &Builder, Preprocessor &PP, llvm::StringRef ImplicitIncludePTH) { PTHManager *P = PP.getPTHManager(); assert(P && "No PTHManager."); - const char *OriginalFile = P->getOriginalSourceFile(); + // Null check 'P' in the corner case where it couldn't be created. + const char *OriginalFile = P ? P->getOriginalSourceFile() : 0; if (!OriginalFile) { PP.getDiagnostics().Report(diag::err_fe_pth_file_has_no_source_header)