From 6f118975f9ca6318a933ee4bfad19fae628c9a8d Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 27 May 2010 17:33:40 +0000 Subject: MemoryBuffer::getSTDIN may return a null pointer if an error occurs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104856 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/CompilerInstance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Frontend/CompilerInstance.cpp') diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 2b251682b7..8bedf50c27 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -442,7 +442,7 @@ bool CompilerInstance::InitializeSourceManager(llvm::StringRef InputFile, } } else { llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN(); - SourceMgr.createMainFileIDForMemBuffer(SB); + if (SB) SourceMgr.createMainFileIDForMemBuffer(SB); if (SourceMgr.getMainFileID().isInvalid()) { Diags.Report(diag::err_fe_error_reading_stdin); return false; -- cgit v1.2.3-18-g5258