Windows/Process.inc: Fix for +Asserts. &Buf[0] is not guaranteed if size is zero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192103 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2013-10-07 15:33:30 +00:00
parent cfa7d81a45
commit e11f460ee0

View File

@ -161,7 +161,7 @@ Optional<std::string> Process::GetEnv(StringRef Name) {
SmallVector<wchar_t, MAX_PATH> Buf;
size_t Size = MAX_PATH;
do {
Buf.reserve(Size);
Buf.resize(Size);
Size = GetEnvironmentVariableW(&NameUTF16[0], &Buf[0], Buf.capacity());
if (Size == 0)
return None;