瀏覽代碼

io_win32_unittest: fix condition in GetCwdAsUtf8

Laszlo Csomor 7 年之前
父節點
當前提交
eb3bd6ec29
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/google/protobuf/stubs/io_win32_unittest.cc

+ 1 - 1
src/google/protobuf/stubs/io_win32_unittest.cc

@@ -130,7 +130,7 @@ bool GetEnvVarAsUtf8(const WCHAR* name, string* result) {
 
 bool GetCwdAsUtf8(string* result) {
   DWORD size = ::GetCurrentDirectoryW(0, NULL);
-  if (size == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
+  if (size > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
     scoped_array<WCHAR> wcs(new WCHAR[size]);
     ::GetCurrentDirectoryW(size, wcs.get());
     // GetCurrentDirectoryA retrieves an Active-Code-Page-encoded text which