Don't call 'FilesToRemove[0]' when the vector is empty, even to compute

the address of it. Found by a checking STL implementation used on
a dragonegg builder. Sorry about this one. =/

llvm-svn: 158582
This commit is contained in:
Chandler Carruth 2012-06-16 00:44:07 +00:00
parent f5cad928f5
commit 52de271da1
1 changed files with 1 additions and 1 deletions

View File

@ -189,7 +189,7 @@ void llvm::sys::SetInterruptFunction(void (*IF)()) {
bool llvm::sys::RemoveFileOnSignal(const sys::Path &Filename,
std::string* ErrMsg) {
SignalsMutex.acquire();
std::string *OldPtr = &FilesToRemove[0];
std::string *OldPtr = FilesToRemove.empty() ? 0 : &FilesToRemove[0];
FilesToRemove.push_back(Filename.str());
// We want to call 'c_str()' on every std::string in this vector so that if