diff --git a/SystemTools.cxx b/SystemTools.cxx index eb2bec65fc66ef41a8aed80d50f1e998b8a080c9..1a73b164b4b24d65346bfa9c5fa960c72b9f0b61 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -4725,8 +4725,11 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath) std::wstring wtempPath = Encoding::ToWide(tempPath); DWORD ret = GetShortPathNameW(wtempPath.c_str(), NULL, 0); std::vector<wchar_t> buffer(ret); - ret = GetShortPathNameW(wtempPath.c_str(), - &buffer[0], static_cast<DWORD>(buffer.size())); + if (ret != 0) + { + ret = GetShortPathNameW(wtempPath.c_str(), + &buffer[0], static_cast<DWORD>(buffer.size())); + } if (ret == 0) {